FindFirstChild (Function): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>GoldenUrg fixed layout; added examples |
>GoldenUrg Added link |
||
Line 32: | Line 32: | ||
part = Game:FindFirstChild("Part") | part = Game:FindFirstChild("Part") | ||
Will not. | Will not. | ||
==See Also== | |||
[[Instance Hierarchy]] |
Revision as of 04:10, 14 June 2010
|
Example
--This looks in the Workspace for anything named "Brick", -- and sets the variable "found" to whatever object it finds. -- if nothing is found, then found is nil. found = Workspace:FindFirstChild("Brick") if found ~= nil then -- This makes sure that it actually found something. found.Name = "blah" --Sets the object's name to "blah" end
Recursive
The recursive argument is optional. If given, Recursive sets whether the function should look inside of objects in the calling object, as well as the calling object. If not given, the default is false.
For example, if there is a part in Workspace called "Part" and you use:
part = Game:FindFirstChild("Part", true)
It will find the part.
part = Game:FindFirstChild("Part", false)
OR
part = Game:FindFirstChild("Part")
Will not.