FindFirstChild returns the child if it can find a child of the instance you call it on with a name equal to the string you provide.
1 | local child = instance:FindFirstChild( "ChildName" ) |
If it can't find the child it returns nil
You can use instance.ChildName
but this will error if ChildName is not a valid member of instance. To get around the error you use FindFirstChild with a if statement
1 | local child = instance:FindFirstChild( "ChildName" ) |
WaitForChild yields until it can find a child of the instance you called it on with a name equal to the string you provide
1 | local child = instance:WaitForChild( "ChildName" ) |
2 | print 'child now exists!' |
This is used if you want to yield code until a child exists