What's the difference between the two functions: FindFirstChild and FindFirstChildWhichIsA?
FindFirstChild():
1 | local child = script.Parent:FindFirstChild( "Humanoid" ) |
FindFirstChildWhichIsA():
1 | local child = script.Parent:FindFirstChildWhichIsA( "Humanoid" ) |
The difference is that FindFirstChild() looks for an Instance with the given name while FindFirstChildWhichIsA() finds the Instance of a Class regardless of its name. Both methods can be used to find descendants and not just children like so:
1 | local child 1 = script.Parent:FindFirstChild( "Humanoid" , true ) |
2 | local child 2 = script.Parent:FindFirstChildWhichIsA( "Humanoid" , true ) |
What do we have here? The second parameter, a boolean, can be used to tell the method(s) to either find a child (false) or a descendant (true). Depending on what you are finding, finding a descendant is recommended.