Scripting / Method
FindFirstChild()
Finds a named child without assuming that the object exists.
Syntax
instance:FindFirstChild(name, recursive?)Parameters and return value
| Name | Type | Description |
|---|---|---|
name | string | Exact child name to search for. |
recursive | boolean? | When true, searches descendants instead of only direct children. |
return | Instance or nil | Matching object, or nil if not found. |
Example: Safely Find An Optional Part
Luau
local part = workspace:FindFirstChild("MovingPart")
if part then
part.Position = Vector3.new(0, 8, 0)
endThe Workspace and normal Instance versions support the optional recursive argument.
Players:FindFirstChild(name) searches direct player children only.Recursive lookup
Luau
local nestedPart = workspace:FindFirstChild("NestedPart", true)
if nestedPart then
print(nestedPart:GetFullName())
end