Add examples/clarification of using the 2nd argument of :FindFirstChild()

In the documentation regarding both :FindFirstChild() and :FindFirstChildWhichIsA(), there is a second argument which indicates whether or not it would be recursive.

The explanation is not very clear: “… the function searches all descendants rather than only the immediate children of the Instance”. I don’t fully understand it.

It would be helpful for new developers to learn how to use the recursive argument if there were examples on how it is used (such as example code).

2 Likes

It’s very clear if you understand Recursion

using the 2nd parameter means that instead of FindFirstChild the method becomes FindFirstDescendant

For example:

game:FindFirstChild(“Name”,true)

If your game has an Instance called Name it will be found unless it’s inside of nil

It’s basically either GetChildren() and GetDescendants() then comparing the Name

4 Likes

This might not be relevant but most people don’t know about the 2nd parameter of WaitForChild() which is a number specifiying how long in seconds the wait for child should last.

5 Likes