Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

Maybe try this?

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

2 comments

0

" repeat wait() until game.Players.LocalPlayer " instead of " game.Players.PlayerAdded:Connect(function() "

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.

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.
]]

This discussion is preserved as it was. New answers, comments, and votes are closed.