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

local frame = script.Parent

frame:TweenPosition(UDim2.new(.5,0,.55,0), 'Out', 'Bounce', 10)

2 answers

Log in to vote
0
Answered by 8 years ago
local player = game.Players.LocalPlayer
if player and player.PlaeyrGui and player.Character then
local frame = script.Parent

frame:TweenPosition(UDim2.new(.5,0,.55,0), 'Out', 'Bounce', 10)
end

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

Ad
Log in to vote
2
Answered by 8 years ago
repeat wait() until game.Players.LocalPlayer.Character

local frame = script.Parent

frame: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