Skip to main content

ClientTableReplicator

This item only works when running on the client. Client

Inherits from BaseTableReplicator

warning

You must call ClientTableReplicator.requestServerData() in order to begin replication to the client. It should only be called ideally once and after all listeners have been registered.

Functions

fromTemplate

Static
ClientTableReplicator.fromTemplate() → ()

Creates a ReplicatedTableSingleton object from the given template configuration.

See TableReplicatorSingleton.new for more information.

onNew

ClientTableReplicator.onNew(
classTokenNamestring,
fn(replicatorClientTableReplicator) → ()
) → () → ()

Listens for a new ClientTableReplicator of the given ClassName.

Listening after server data loaded

If you call this method after the ClientTableReplicator has already requested and loaded the server data, then this listener may miss the creation of some replicators. It is recommended to call this method before calling .requestServerData() or use .forEach() instead.

requestServerData

ClientTableReplicator.requestServerData() → Promise

Requests all the existing replicators from the server. This should only be called once, calling it multiple times will return the same promise. All replicator listeners should be registered before calling this method.

Show raw api
{
    "functions": [
        {
            "name": "fromTemplate",
            "desc": "Creates a ReplicatedTableSingleton object from the given template configuration.\n\nSee [TableReplicatorSingleton.new](TableReplicatorSingleton#new) for more information.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "tags": [
                "Static"
            ],
            "source": {
                "line": 91,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "bind",
            "desc": "Binds the given table to a ClientTableReplicator ClassName. This method is unfinished ans should not be used.",
            "params": [
                {
                    "name": "tblOrStr",
                    "desc": "",
                    "lua_type": "table | string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "table\r\n"
                }
            ],
            "function_type": "static",
            "private": true,
            "unreleased": true,
            "source": {
                "line": 98,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "_newReplicator",
            "desc": "The CTR constructor. is private because it should not be called externally.",
            "params": [
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "{\r\n    Id: Id;\r\n    Parent: ClientTableReplicator?;\r\n    TableManager: TableManager;\r\n    ClassTokenName: string?;\r\n    Tags: Tags?;\r\n}"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 136,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "new",
            "desc": "This method exists to catch people trying to do something they shouldnt.",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 174,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "onNew",
            "desc": "Listens for a new ClientTableReplicator of the given ClassName.\n\n:::caution Listening after server data loaded\nIf you call this method after the ClientTableReplicator has already requested and loaded the server data,\nthen this listener may miss the creation of some replicators. It is recommended to call this method before\ncalling `.requestServerData()` or use `.forEach()` instead.\n:::",
            "params": [
                {
                    "name": "classTokenName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "fn",
                    "desc": "",
                    "lua_type": "(replicator: ClientTableReplicator) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 188,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Overrides the default Destroy method to prevent the user from destroying",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 204,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "_Destroy",
            "desc": "This is the actual Destroy method.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 212,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        },
        {
            "name": "requestServerData",
            "desc": "Requests all the existing replicators from the server. This should only\nbe called once, calling it multiple times will return the same promise.\nAll replicator listeners should be registered before calling this method.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 323,
                "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ClientTableReplicator",
    "desc": "Inherits from [BaseTableReplicator](#BaseTableReplicator)\n\n:::warning\nYou must call `ClientTableReplicator.requestServerData()` in order to begin\nreplication to the client. It should only be called ideally once and after\nall listeners have been registered.\n:::",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 16,
        "path": "lib/tablereplicator/src/Client/ClientTableReplicator.luau"
    }
}