script.Parent.Play.TextButton.MouseButton1Click:Connect(function()
script.Enabled = false
for i, v in pairs(script.Parent:GetDescendants()) do
if v:IsA("TextButton") then
v.Visible = false
end
end
tweenService:Create(script.Parent, tweenInfoPopups, {Position = UDim2.new(0.5,0,1.25,0)}):Play()
tweenService:Create(script.Parent.Parent.Title. tweenInfoPopups, {Position = UDim2.new(0.5,0,-1.25,0)}):Play()
tweenService:Create(script.Parent.Parent.Parent.Transition, tweenInfoPopups, {Position = UDim2.new(0,0,.5,0)}):Play()
wait(1)
script.Parent.Parent.Parent.CameraScript.Enabled = false
game.Workspace.Camera.CameraType = Enum.CameraType.Custom
tweenService:Create(script.Parent.Parent.Parent.Transition, tweenInfoPopups, {position = UDim2.new(-1,0,.5,0)}):Play()
wait(1)
script.Parent.Parent.Parent.Destroy()
end)
我正在关注 yt 上的教程,然后当我完成后,我尝试测试游戏,但它说这一行参数 2 丢失或为零:
tweenService:Create(script.Parent, tweenInfoPopups, {Position = UDim2.new(0.5,0,1.25,0)}):Play()
TweenInfo
参数,这是您正在使用的方法 TweenService:Create()
的第二个参数。您将变量 tweenInfoPopups
作为第二个参数,但似乎您缺少导致出现错误的变量。
local tweenInfoPopups: TweenInfo = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
TweenInfo
的变量,您可以通过将其添加到脚本顶部或导致错误的行之前来修复错误。我已经注释掉了每个参数的含义,以便您知道每个参数的作用。