---
title: "WaitForChild()"
description: "Waits until a direct child with the requested name exists, or until an optional timeout expires."
canonical: "https://docs.glorpia.com/scripting/functions/wait-for-child"
markdown: "https://docs.glorpia.com/scripting/functions/wait-for-child.md"
---
# WaitForChild()

Waits until a direct child with the requested name exists, or until an optional timeout expires.

**Category:** Scripting / Method

## Syntax

```luau
instance:WaitForChild(name, timeout?)
```

## Parameters and return value

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | Exact direct-child name to wait for. |
| `timeout` | number? | Optional maximum wait time in seconds. |
| `return` | Instance or nil | The matching child. Returns nil when a supplied timeout expires. |

> **Note:** Without a timeout, the call yields until the named direct child exists. It does not search descendants.

## Example: Wait For A Character Part

```luau
local character = script.Parent
local root = character:WaitForChild("HumanoidRootPart")

print(root.Position)
```

## Example: Use A Timeout

```luau
local optionalPart = workspace:WaitForChild("RoundStart", 5)

if optionalPart then
    print("RoundStart is ready")
else
    warn("RoundStart did not appear within 5 seconds")
end
```

## Related

- [FindFirstChild()](https://docs.glorpia.com/scripting/functions/find-first-child.md) — Check immediately for a named child without yielding.
- [FindFirstChildWhichIsA()](https://docs.glorpia.com/scripting/functions/find-first-child-which-is-a.md) — Find a child by class or supported base class.
