Skip to main content

ClientRemoteProperty

This item only works when running on the client. Client

Created via ClientComm:GetProperty().

Properties

Changed

ClientRemoteProperty.Changed: Signal<any>

Fires when the property receives an updated value from the server.

clientRemoteProperty.Changed:Connect(function(value)
	print("New value", value)
end)

Functions

Get

ClientRemoteProperty:Get() → any

Gets the value of the property object.

caution

This value might not be ready right away. Use OnReady() or IsReady() before calling Get(). If not ready, this value will return nil.

OnReady

ClientRemoteProperty:OnReady() → Promise<any>

Returns a Promise which resolves once the property object is ready to be used. The resolved promise will also contain the value of the property.

-- Use andThen clause:
clientRemoteProperty:OnReady():andThen(function(initialValue)
	print(initialValue)
end)

-- Use await:
local success, initialValue = clientRemoteProperty:OnReady():await()
if success then
	print(initialValue)
end

IsReady

ClientRemoteProperty:IsReady() → boolean

Returns true if the property object is ready to be used. In other words, it has successfully gained connection to the server-side version and has synced in the initial value.

if clientRemoteProperty:IsReady() then
	local value = clientRemoteProperty:Get()
end

Observe

ClientRemoteProperty:Observe(observer(any) → nil) → Connection

Observes the value of the property. The observer will be called right when the value is first ready, and every time the value changes. This is safe to call immediately (i.e. no need to use IsReady or OnReady before using this method).

Observing is essentially listening to Changed, but also sends the initial value right away (or at least once OnReady is completed).

local function ObserveValue(value)
	print(value)
end

clientRemoteProperty:Observe(ObserveValue)

Destroy

ClientRemoteProperty:Destroy() → ()

Destroys the ClientRemoteProperty object.

Show raw api
{
    "functions": [
        {
            "name": "Get",
            "desc": "Gets the value of the property object.\n\n:::caution\nThis value might not be ready right away. Use `OnReady()` or `IsReady()`\nbefore calling `Get()`. If not ready, this value will return `nil`.\n:::",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 71,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        },
        {
            "name": "OnReady",
            "desc": "Returns a Promise which resolves once the property object is\nready to be used. The resolved promise will also contain the\nvalue of the property.\n\n```lua\n-- Use andThen clause:\nclientRemoteProperty:OnReady():andThen(function(initialValue)\n\tprint(initialValue)\nend)\n\n-- Use await:\nlocal success, initialValue = clientRemoteProperty:OnReady():await()\nif success then\n\tprint(initialValue)\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<any>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 94,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        },
        {
            "name": "IsReady",
            "desc": "Returns `true` if the property object is ready to be\nused. In other words, it has successfully gained\nconnection to the server-side version and has synced\nin the initial value.\n\n```lua\nif clientRemoteProperty:IsReady() then\n\tlocal value = clientRemoteProperty:Get()\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 110,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        },
        {
            "name": "Observe",
            "desc": "Observes the value of the property. The observer will\nbe called right when the value is first ready, and\nevery time the value changes. This is safe to call\nimmediately (i.e. no need to use `IsReady` or `OnReady`\nbefore using this method).\n\nObserving is essentially listening to `Changed`, but\nalso sends the initial value right away (or at least\nonce `OnReady` is completed).\n\n```lua\nlocal function ObserveValue(value)\n\tprint(value)\nend\n\nclientRemoteProperty:Observe(ObserveValue)\n```",
            "params": [
                {
                    "name": "observer",
                    "desc": "",
                    "lua_type": "(any) -> nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Connection"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 135,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Destroys the ClientRemoteProperty object.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 145,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Changed",
            "desc": "Fires when the property receives an updated value\nfrom the server.\n\n```lua\nclientRemoteProperty.Changed:Connect(function(value)\n\tprint(\"New value\", value)\nend)\n```",
            "lua_type": "Signal<any>",
            "source": {
                "line": 23,
                "path": "modules/comm/Client/ClientRemoteProperty.luau"
            }
        }
    ],
    "types": [],
    "name": "ClientRemoteProperty",
    "desc": "Created via `ClientComm:GetProperty()`.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 29,
        "path": "modules/comm/Client/ClientRemoteProperty.luau"
    }
}