Skip to main content

Observe

Provides utility functions for observing instance properties, attributes, and children, immediately invoking callbacks with the current value and then again on every subsequent change.

Functions

Property

Observe.Property(
instanceInstance,--

The instance to observe

propertystring,--

The name of the property to observe

callbackfunction--

Called with the current value immediately and on every change

) → RBXScriptConnection

Observes the given property on an instance, immediately calling callback with the current value and again whenever the property changes.

Attribute

Observe.Attribute(
instanceInstance,--

The instance to observe

attributestring,--

The name of the attribute to observe

callbackfunction--

Called with the current value immediately and on every change

) → RBXScriptConnection

Observes the given attribute on an instance, immediately calling callback with the current value and again whenever the attribute changes.

Children

Observe.Children(
instanceInstance,--

The instance to observe

callbackfunction--

Called with the full children list immediately and on every change

) → RBXScriptConnection

Observes the children of an instance, immediately calling callback with the current children and again whenever a child is added or removed.

Returns a connection-like table with Disconnect() and Connected members, compatible with standard connection cleanup patterns.

Show raw api
{
    "functions": [
        {
            "name": "Property",
            "desc": "Observes the given property on an instance, immediately calling `callback`\nwith the current value and again whenever the property changes.",
            "params": [
                {
                    "name": "instance",
                    "desc": "The instance to observe",
                    "lua_type": "Instance"
                },
                {
                    "name": "property",
                    "desc": "The name of the property to observe",
                    "lua_type": "string"
                },
                {
                    "name": "callback",
                    "desc": "Called with the current value immediately and on every change",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "src/shared/core/lib/Observe.luau"
            }
        },
        {
            "name": "Attribute",
            "desc": "Observes the given attribute on an instance, immediately calling `callback`\nwith the current value and again whenever the attribute changes.",
            "params": [
                {
                    "name": "instance",
                    "desc": "The instance to observe",
                    "lua_type": "Instance"
                },
                {
                    "name": "attribute",
                    "desc": "The name of the attribute to observe",
                    "lua_type": "string"
                },
                {
                    "name": "callback",
                    "desc": "Called with the current value immediately and on every change",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 46,
                "path": "src/shared/core/lib/Observe.luau"
            }
        },
        {
            "name": "Children",
            "desc": "Observes the children of an instance, immediately calling `callback` with\nthe current children and again whenever a child is added or removed.\n\nReturns a connection-like table with `Disconnect()` and `Connected` members,\ncompatible with standard connection cleanup patterns.",
            "params": [
                {
                    "name": "instance",
                    "desc": "The instance to observe",
                    "lua_type": "Instance"
                },
                {
                    "name": "callback",
                    "desc": "Called with the full children list immediately and on every change",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 64,
                "path": "src/shared/core/lib/Observe.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Observe",
    "desc": "Provides utility functions for observing instance properties, attributes,\nand children, immediately invoking callbacks with the current value and\nthen again on every subsequent change.",
    "source": {
        "line": 16,
        "path": "src/shared/core/lib/Observe.luau"
    }
}