I'm a bit confused on each each of those means and what they're used for. Can anyone explain the differences of these two?
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.
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
local child = instance:FindFirstChild("ChildName") if child then --ensures child is not nil print'child exists!' end
WaitForChild yields until it can find a child of the instance you called it on with a name equal to the string you provide
local child = instance:WaitForChild("ChildName") print'child now exists!'
This is used if you want to yield code until a child exists