Skip to main content

Child

Finds children of an instance by path. This is useful for finding deeply nested children without having to write a long chain of :FindFirstChild() or :WaitForChild() calls.

Functions

FromPathOptional

Child.FromPathOptional(
rootInstance,--

The root instance to start searching from.

path{string}--

The path to the child, as an array of strings.

) → Instance?--

The child instance, or nil if it doesn't exist.

Seeks a child or descendant from a path, returning nil if it doesn't exist.

FromPathAsync

Child.FromPathAsync(
rootInstance,--

The root instance to start searching from.

path{string},--

The path to the child, as an array of strings.

timeoutAfternumber?--

The time in seconds to wait before giving up. Defaults to infinite.

) → Instance?--

The child instance, or nil if it doesn't exist.

Seeks a child or descendant from a path, waiting for it to exist if it doesn't. Returns nil if the timeout is reached.

Show raw api
{
    "functions": [
        {
            "name": "FromPathOptional",
            "desc": "Seeks a child or descendant from a path, returning nil if it doesn't exist.",
            "params": [
                {
                    "name": "root",
                    "desc": "The root instance to start searching from.",
                    "lua_type": "Instance"
                },
                {
                    "name": "path",
                    "desc": "The path to the child, as an array of strings.",
                    "lua_type": "{string}"
                }
            ],
            "returns": [
                {
                    "desc": "The child instance, or nil if it doesn't exist.",
                    "lua_type": "Instance?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 16,
                "path": "src/Packages/Child/init.luau"
            }
        },
        {
            "name": "FromPathAsync",
            "desc": "Seeks a child or descendant from a path, waiting for it to exist if it doesn't. Returns nil if the timeout is reached.",
            "params": [
                {
                    "name": "root",
                    "desc": "The root instance to start searching from.",
                    "lua_type": "Instance"
                },
                {
                    "name": "path",
                    "desc": "The path to the child, as an array of strings.",
                    "lua_type": "{string}"
                },
                {
                    "name": "timeoutAfter",
                    "desc": "The time in seconds to wait before giving up. Defaults to infinite.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "The child instance, or nil if it doesn't exist.",
                    "lua_type": "Instance?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 39,
                "path": "src/Packages/Child/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Child",
    "desc": "Finds children of an instance by path. This is useful for finding deeply nested children without having to write a long chain of `:FindFirstChild()` or `:WaitForChild()` calls.",
    "source": {
        "line": 6,
        "path": "src/Packages/Child/init.luau"
    }
}