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

Explanation of :WaitForChild?

What does :WaitForChild mean?

1 answer

✓ Accepted answer

By textbook (wiki) definition it says;

Yields the current thread until a child with the Name property of name is found, then returns it.

So it basically waits until the item named in the string, for example "Tool", is existent in the location.

game.Workspace:WaitForChild("Tool")

Once it is existent, it will do it the action you requested on it. So let's say we destroy it,

game.Workspace:WaitForChild("Tool"):Destroy()

The method will wait for the object "Tool" to show up in workspace, then you can change the properties of the object or execute another method on top of it.

1 comment

0

WaitForChild basically repeteadly calls FindFirstChild and, well, waits until something is finally returned by it.

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