应为“(”、“{”或 <string>,得到 'GUI'

Expected '(', '{' or <string>, got 'GUI'

我正在学习加载屏幕教程,但似乎部分代码有误。

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlayerGui:SetTopBarTransparency(0)

local GUI = script.LoadingScreen:Clone
GUI.Parent = PlayerGui --<<-- This part of the script is the part that is causing it

repeat wait(1) until game:IsLoaded()

GUI.Frame:TweenPosition(UDim2.new(0, 0, 1,0),"InOut","Sine",0.5)
wait(0.5)
GUI:Destroy()

您的错误消息告诉您它需要一些括号,但却找到了下一行。 Clone 是一个函数,需要像这样调用:

local GUI = script.LoadingScreen:Clone()