I have seen this in different scripts, and have been using this myself, but I do not know what the difference between the two is, one is just one string, the other has a string and a boolean value, what do they both do?
If the second argument of FindFirstChild
is false or nil, it will only search for the child directly inside the object. However, if the second argument is true, it will search through all descendants by using recursion.
For example, if an object's heirarchy looks like this: game.Workspace.Part.Script
, you can find the script by doing Workspace:FindFirstChild("Script",true)
, even though it's not directly under the Workspace.
Returns the first child found with a name of name. Returns nil if no such child exists. If the optional recursive argument is true, will recursively descend the hierarchy while searching rather than only searching the immediate object. ~ ROBLOX Wiki
This has been a tip of the day on scripting helpers many times, and from my understanding it will search through descendants of descendants such as workspace to find a object with a name matching the string value. So I think if I wanted to destroy a selection box named bob inside a brick which was inside of workspace, then I would use;
workspace:FindFirstChild("bob", true):Destroy()
This is my understanding of it, but I have not tested it.