Skip to main content

RemoteProperty

Weaver's implementation of Knit's RemoteProperties.

Internally, these are simply RemoteEvents which can store different values for clients.

Types

RemoteConnectionCallback

type RemoteConnectionCallback = (...any) → () | (
ClientPlayer,
...any
)

Properties

Changed

This item only works when running on the server. Server
RemoteProperty.Changed: Signal

Fires when the RemoteProperty's value has changed for any player. The first parameter will always be the Player.

If the default value for the RemoteProperty was changed rather than a specific player's value, the first parameter will be nil.

Changed

This item only works when running on the client. Client
RemoteProperty.Changed: Signal

Fires when the RemoteProperty's value has changed. Note that this won't fire if the value that the server sets is the same as your currently registered value.

Functions

Set

This item only works when running on the server. Server
RemoteProperty:Set(Defaultany?) → ()

Sets the default value of the RemoteProperty, clearing all clients' custom values.

SetDefault

This item only works when running on the server. Server
RemoteProperty:SetDefault(Defaultany?) → ()

Sets the default value of the RemoteProperty without clearing all clients' custom values.

SetFor

This item only works when running on the server. Server
RemoteProperty:SetFor(
ForPlayer,
Valueany?
) → ()

Sets the value of this RemoteProperty for a specific client.

SetForEach

This item only works when running on the server. Server
RemoteProperty:SetForEach(
For{Player},
Valueany?
) → ()

Sets the value of this RemoteProperty for the clients specified.

SetExcept

This item only works when running on the server. Server
RemoteProperty:SetExcept(
Excluding{Player},
Valueany?
) → ()

Sets the value of this RemoteProperty for all clients in the game, except for the clients specified.

SetFilter

This item only works when running on the server. Server
RemoteProperty:SetFilter(
Filter(
ClientPlayer,
Valueany?
) → boolean,
Valueany?
) → ()

Sets the value of this RemoteProparty for all clients in the game, using a filter to specify which clients have their values set.

Clear

This item only works when running on the server. Server
RemoteProperty:Clear() → ()

Clears all clients' custom values.

ClearFor

This item only works when running on the server. Server
RemoteProperty:ClearFor(ForPlayer) → ()

Clears the value set for a specific client.

ClearForEach

This item only works when running on the server. Server
RemoteProperty:ClearForEach(For{Player}) → ()

Clears the values set for the clients specified.

ClearExcept

This item only works when running on the server. Server
RemoteProperty:ClearExcept(Excluding{Player}) → ()

Clears the value of all clients in the game, except for the clients specified.

ClearFilter

This item only works when running on the server. Server
RemoteProperty:ClearFilter(Filter(ClientPlayer) → boolean) → ()

Clears the value of all clients in the game, using a filter to specify which clients receive the event.

Get

This item only works when running on the server. Server
RemoteProperty:Get() → any?

Gets the current value of the RemoteProperty.

GetFor

This item only works when running on the server. Server
RemoteProperty:GetFor(ClientPlayer) → any?

Gets the current value of the RemoteProperty for Client.

Get

This item only works when running on the client. ClientThis is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. Yields
RemoteProperty:Get() → any?

Gets the current value of the RemoteProperty.

Yielding

This function will yield when you first call :Get() if the server has not sent a Changed event at least once. If this is an issue that worries you, try calling :Get() once in WeaverController:WeaverInit() so that the value is guaranteed to exist.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new RemoteProperty object.",
            "params": [
                {
                    "name": "From",
                    "desc": "The RemoteEvent to hook.",
                    "lua_type": "RemoteEvent"
                },
                {
                    "name": "Default",
                    "desc": "The default value of the RemoteProperty.",
                    "lua_type": "any?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RemoteProperty"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 147,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "Set",
            "desc": "Sets the default value of the RemoteProperty, clearing all clients' custom values.\n\n\t",
            "params": [
                {
                    "name": "Default",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 213,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "SetDefault",
            "desc": "Sets the default value of the RemoteProperty without clearing all clients' custom values.\n\n\t",
            "params": [
                {
                    "name": "Default",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 228,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "SetFor",
            "desc": "Sets the value of this RemoteProperty for a specific client.\n\n\t",
            "params": [
                {
                    "name": "For",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "Value",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 248,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "SetForEach",
            "desc": "Sets the value of this RemoteProperty for the clients specified.\n\n\t",
            "params": [
                {
                    "name": "For",
                    "desc": "",
                    "lua_type": "{ Player }"
                },
                {
                    "name": "Value",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 267,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "SetExcept",
            "desc": "Sets the value of this RemoteProperty for all clients in the game, except for the clients specified.\n\n\t",
            "params": [
                {
                    "name": "Excluding",
                    "desc": "",
                    "lua_type": "{ Player }"
                },
                {
                    "name": "Value",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 277,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "SetFilter",
            "desc": "Sets the value of this RemoteProparty for all clients in the game, using a filter to specify which clients have their values set.\n\n\t",
            "params": [
                {
                    "name": "Filter",
                    "desc": "",
                    "lua_type": "(Client: Player, Value: any?) -> boolean"
                },
                {
                    "name": "Value",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 289,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "Clear",
            "desc": "Clears all clients' custom values.\n\n\t",
            "params": [],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 304,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "ClearFor",
            "desc": "Clears the value set for a specific client.\n\n\t",
            "params": [
                {
                    "name": "For",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 312,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "ClearForEach",
            "desc": "Clears the values set for the clients specified.\n\n\t",
            "params": [
                {
                    "name": "For",
                    "desc": "",
                    "lua_type": "{ Player }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 328,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "ClearExcept",
            "desc": "Clears the value of all clients in the game, except for the clients specified.\n\n\t",
            "params": [
                {
                    "name": "Excluding",
                    "desc": "",
                    "lua_type": "{ Player }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 338,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "ClearFilter",
            "desc": "Clears the value of all clients in the game, using a filter to specify which clients receive the event.\n\n\t",
            "params": [
                {
                    "name": "Filter",
                    "desc": "",
                    "lua_type": "(Client: Player) -> boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 350,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "Get",
            "desc": "Gets the current value of the RemoteProperty.\n\n\t",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 365,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "GetFor",
            "desc": "Gets the current value of the RemoteProperty for `Client`.\n\n\t",
            "params": [
                {
                    "name": "Client",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 373,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "Get",
            "desc": "Gets the current value of the RemoteProperty.\n\n:::caution Yielding\n\nThis function will yield when you first call `:Get()` if the server has not sent a Changed event at least once. If this is an issue that worries you, try calling `:Get()` once in [`WeaverController:WeaverInit()`](WeaverClient#WeaverController) so that the value is guaranteed to exist.\n\n:::\n\n\t",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "yields": true,
            "source": {
                "line": 390,
                "path": "src/Internals/RemoteProperty.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Changed",
            "desc": "Fires when the RemoteProperty's value has changed for any player. The first parameter will always be the `Player`.\n\nIf the default value for the RemoteProperty was changed rather than a specific player's value, the first parameter will be `nil`.",
            "lua_type": "Signal",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 107,
                "path": "src/Internals/RemoteProperty.luau"
            }
        },
        {
            "name": "Changed",
            "desc": "Fires when the RemoteProperty's value has changed. Note that this won't fire if the value that the server sets is the same as your currently registered value.",
            "lua_type": "Signal",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 115,
                "path": "src/Internals/RemoteProperty.luau"
            }
        }
    ],
    "types": [
        {
            "name": "RemoteConnectionCallback",
            "desc": "",
            "lua_type": "(...any) -> () | (Client: Player, ...any)",
            "source": {
                "line": 96,
                "path": "src/Internals/RemoteProperty.luau"
            }
        }
    ],
    "name": "RemoteProperty",
    "desc": "Weaver's implementation of Knit's [RemoteProperties](https://sleitnick.github.io/RbxUtil/api/RemoteProperty/).\n\nInternally, these are simply RemoteEvents which can store different values for clients.",
    "source": {
        "line": 9,
        "path": "src/Internals/RemoteProperty.luau"
    }
}