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(
instance: Instance,--

The instance to observe

property: string,--

The name of the property to observe

callback: function--

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(
instance: Instance,--

The instance to observe

attribute: string,--

The name of the attribute to observe

callback: function--

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(
instance: Instance,--

The instance to observe

callback: function--

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"
    }
}