Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I can't tween guis anymore? Are they broken?

Asked by 6 years ago

So i made a tween gui that tweens when the player joins. but it's not tweening. Any help?

game.Players.PlayerAdded:Connect(function()
    wait(1)
    script.Parent:TweenPosition(UDim2.new(0, 0,0, 0))
end)

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Maybe try this?

game.Players.PlayerAdded:Connect(function()
    wait(1)
    script.Parent:TweenPosition(UDim2.new(0, 0,0, 0),"Out",1,true)
end)

0
" repeat wait() until game.Players.LocalPlayer " instead of " game.Players.PlayerAdded:Connect(function() " IfIWasntSoSwag 98 — 6y
0
Your comment is correct. You should edit your answer (bottom of the post below the comments there is Edit/Remove/Report). Note that the arguments you added to TweenPosition are optional and not the cause of the problem. chess123mate 5873 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

You shouldn't be using game.Players.PlayerAdded in a LocalScript to wait for the LocalPlayer to join because the LocalPlayer will have already joined by the time your script runs. You might be able to wait for their character to be added (game.Players.LocalPlayer.CharacterAdded:Wait()), but otherwise just do your script:

wait(1)
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0))

In the future, add print statements through-out your script so that you can now what is/isn't running. This will give you clues as to what's wrong. ex, in your case you might've done:

print("Script started")
game.Players.PlayerAdded:Connect(function()
    print("PlayerAdded fired")
    wait(1)
    print("After wait")
    script.Parent:TweenPosition(UDim2.new(0, 0,0, 0))
    print("After Tween")
end)
print("Script setup complete")

--[[Output would be:

Script started
Script setup complete

Which would tell you that what's wrong is the PlayerAdded line, not the Tween line.
]]

Answer this question