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

How can I make this waitforchild?

Asked by 9 years ago

It's a simple script but I can't get it to wait for the player to load up before it starts doing the tween.

1local frame = script.Parent
2 
3frame:TweenPosition(UDim2.new(.5,0,.55,0), 'Out', 'Bounce', 10)

2 answers

Log in to vote
0
Answered by 9 years ago
1local player = game.Players.LocalPlayer
2if player and player.PlaeyrGui and player.Character then
3local frame = script.Parent
4 
5frame:TweenPosition(UDim2.new(.5,0,.55,0), 'Out', 'Bounce', 10)
6end

This would be better if you wanted it to wait for everything to be in.

Ad
Log in to vote
2
Answered by 9 years ago
1repeat wait() until game.Players.LocalPlayer.Character
2 
3local frame = script.Parent
4 
5frame:TweenPosition(UDim2.new(.5,0,.55,0), 'Out', 'Bounce', 10)

The first line repeatedly waits until the Player is loaded and then executes the rest below.

Answer this question