Skip to main content

ReplicaClient

This item only works when running on the client. ClientReplica

A class for receiving replicated objects from the server.

Functions

getReplicaById

ReplicaClient.getReplicaById(
replicaIdstring--

The id of the replica to get

) → ReplicaClient?

Gets an existing replica

getReplicaAddedSignal

ReplicaClient.getReplicaAddedSignal(
classstring,--

Configuration for the replicated object

fireForExistingboolean?--

If true, fire the signal for all existing replicas

) → Signal.Signal<ReplicaClient>--

The signal that is fired when a new replica is added

Starts listening for new replicated objects of the specified class

Use fireForExisting to fire the signal for all existing replicas of the specified class.

GetKeyChangedSignal

ReplicaClient:GetKeyChangedSignal(
keystring--

The key to get the value of

) → Signal.Signal<ReplicaClient>

Returns a Signal that fires when a key in the replica is updated

Usage:

local replica = ReplicaClient.getReplicaById("replicaId")

replica:GetKeyChangedSignal("key"):Connect(function(value)
	print("Key changed:", value)
end)
Show raw api
{
    "functions": [
        {
            "name": "GetKeyChangedSignal",
            "desc": "Returns a Signal that fires when a key in the replica is updated\n\nUsage:\n```lua\nlocal replica = ReplicaClient.getReplicaById(\"replicaId\")\n\nreplica:GetKeyChangedSignal(\"key\"):Connect(function(value)\n\tprint(\"Key changed:\", value)\nend)\n```",
            "params": [
                {
                    "name": "key",
                    "desc": "The key to get the value of",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Signal.Signal<ReplicaClient>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 80,
                "path": "src/Replica/ReplicaClient.luau"
            }
        },
        {
            "name": "getReplicaById",
            "desc": "Gets an existing replica",
            "params": [
                {
                    "name": "replicaId",
                    "desc": "The id of the replica to get",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ReplicaClient?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 104,
                "path": "src/Replica/ReplicaClient.luau"
            }
        },
        {
            "name": "getReplicaAddedSignal",
            "desc": "Starts listening for new replicated objects of the specified class\n\nUse `fireForExisting` to fire the signal for all existing replicas of the specified class.",
            "params": [
                {
                    "name": "class",
                    "desc": "Configuration for the replicated object",
                    "lua_type": "string"
                },
                {
                    "name": "fireForExisting",
                    "desc": "If true, fire the signal for all existing replicas",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "The signal that is fired when a new replica is added",
                    "lua_type": "Signal.Signal<ReplicaClient>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 123,
                "path": "src/Replica/ReplicaClient.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ReplicaClient",
    "desc": "A class for receiving replicated objects from the server.",
    "tags": [
        "Replica"
    ],
    "realm": [
        "Client"
    ],
    "source": {
        "line": 8,
        "path": "src/Replica/ReplicaClient.luau"
    }
}