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

correct way to waitforchild() ? help!

Ok so local script inside starterGui This is a really important part of my game and I need to make sure that the frame and the local script has loaded

v StarterGui LocalScript v Frame MainScript (disabled)

( LocalScript named LocalScript)

wait(5)
script = Script.Parent.Frame:WaitForChild("MainScript")
wait(2)
script.Disabled = false

( LocalScript named MainScript)

print("ok")

The script worked for me, but I just need to know if this is a good way of checking if the script has loaded or there is a better way?

1 answer

✓ Accepted answer

yes, the sole reason why WaitForChild exists is to wait for an instance to load before continuing execution of the code

1 comment

0

ok

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