Skip to main content

Replicator

Server-to-client diff-based replication system.

Functions

new

This item only works when running on the server. Server
Replicator.new(
identifierstring,
baseData{[string]any}
) → ()

Creates a new Replicator instance. Use only on server.

getReplicator

Replicator.getReplicator(identifierstring) → Replicator?

Gets the Replicator instance with the given identifier. Returns nil if the Replicator instance does not exist.

waitForReplicator

Replicator.waitForReplicator(
identifierstring,
maxTimenumber?
) → Replicator?

Waits for the Replicator instance with the given identifier to be created. Returns nil if the Replicator instance does not exist after the given time.

initClient

This item only works when running on the client. Client
Replicator.initClient() → ()

Initializes the Replicator system on the client.

initServer

This item only works when running on the server. Server
Replicator.initServer() → ()

Initializes the Replicator system on the server.

Set

This item only works when running on the server. Server
Replicator.Set(
selfReplicator,
path{string},
valueany
) → ()

Sets the value of the Replicator instance at the given path, which replicates to all subscribed players.

Get

Replicator.Get(selfReplicator) → ()

Gets the current state of the Replicator instance.

Subscribe

This item only works when running on the server. Server
Replicator.Subscribe(
selfReplicator,
playerPlayer
) → ()

Subscribes the given player to the Replicator instance.

Unsubscribe

This item only works when running on the server. Server
Replicator.Unsubscribe(
selfReplicator,
playerPlayer
) → ()

Unsubscribes the given player from the Replicator instance.

SubscribeAll

This item only works when running on the server. Server
Replicator.SubscribeAll(selfReplicator) → ()

Subscribes all players to the Replicator instance.

Destroy

This item only works when running on the server. Server
Replicator.Destroy(selfReplicator) → ()

Destroys the Replicator instance.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new Replicator instance. Use only on server.",
            "params": [
                {
                    "name": "identifier",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "baseData",
                    "desc": "",
                    "lua_type": "{[string]: any}"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 49,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "getReplicator",
            "desc": "Gets the Replicator instance with the given identifier.\nReturns nil if the Replicator instance does not exist.",
            "params": [
                {
                    "name": "identifier",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Replicator?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 72,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "waitForReplicator",
            "desc": "Waits for the Replicator instance with the given identifier to be created.\nReturns nil if the Replicator instance does not exist after the given time.",
            "params": [
                {
                    "name": "identifier",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "maxTime",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Replicator?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 81,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "initClient",
            "desc": "Initializes the Replicator system on the client.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 101,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "initServer",
            "desc": "Initializes the Replicator system on the server.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 150,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "Set",
            "desc": "Sets the value of the Replicator instance at the given path, which replicates to all subscribed players.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                },
                {
                    "name": "path",
                    "desc": "",
                    "lua_type": "{string}"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 214,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "Get",
            "desc": "Gets the current state of the Replicator instance.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 253,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "Subscribe",
            "desc": "Subscribes the given player to the Replicator instance.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 263,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "Unsubscribe",
            "desc": "Unsubscribes the given player from the Replicator instance.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 288,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "SubscribeAll",
            "desc": "Subscribes all players to the Replicator instance.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 306,
                "path": "src/Packages/Replicator/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Destroys the Replicator instance.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Replicator"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 322,
                "path": "src/Packages/Replicator/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Replicator",
    "desc": "Server-to-client diff-based replication system.",
    "source": {
        "line": 6,
        "path": "src/Packages/Replicator/init.luau"
    }
}