TableReplicator
Replicates TableManager instances from the server to clients. A
ServerReplicator wraps a TableManager, decides which players can see it,
and mirrors every write to a matching ClientReplicator on each targeted client.
Access the API through TableReplicator.Server (server) or
TableReplicator.Client (client).
Server
local ServerReplicator = require(Packages.TableReplicator).Server
Players.PlayerAdded:Connect(function(player)
local replicator = ServerReplicator.new({
Namespace = "PlayerData",
Data = { Coins = 0 },
ReplicationTargets = player,
})
replicator.Manager:Set("Coins", 100) -- automatically replicated
player.Destroying:Connect(function()
replicator:Destroy()
end)
end)
Client
local ClientReplicator = require(Packages.TableReplicator).Client
-- Register listeners before requesting data to catch replicators in the snapshot.
ClientReplicator.ForEach("PlayerData", function(replicator)
replicator.Manager:Observe("Coins", function(coins)
print("Coins:", coins)
end)
end)
ClientReplicator.RequestData()
Exported Types
- ServerReplicator
- ClientReplicator
- BaseReplicator
- Replicator
- ReplicationToken
- ReplicationTargets
- SearchCondition
- Tags
- FireMode
Types
ReplicationToken
type ReplicationToken = {Name: string}
An optional, opt-in handle that exclusively owns a namespace name for its
lifetime. Tokens are created with ServerReplicator.TOKEN("MyToken") and
enforce collision safety: no other token or raw-string replicator may claim
the same name while this token is alive.
Tokens are optional — a Namespace can be a plain string without a token.
Use TOKEN() only when you need the collision guard.
To release ownership, call ServerReplicator.TOKEN.destroy(token) after all
replicators using this namespace have been destroyed.
ReplicationTargets
The Player(s) that a top-level replicator should replicate to.
"all" replicates to all current and future players.
FireMode
type FireMode = "immediate" | "deferred" | "bindable"
Controls how discovery listeners (ReplicatorCreated, ForEach, OnNew)
are scheduled when a matching replicator is found:
"immediate": runs right away, on a new thread (likeSignal:Fire)."deferred": runs at the end of the resumption cycle (likeSignal:FireDeferred).-
"bindable": mirrorsBindableEventbehavior for the currentWorkspace.SignalBehaviorsetting -- immediate or deferred (likeSignal:FireBindable).
Defaults to "bindable". Set via ServerReplicator.SetListenerFireMode/
ClientReplicator.SetListenerFireMode.
SearchCondition
type SearchCondition = string | ReplicationToken | Tags | (replicator: ServerReplicator | ClientReplicator) → booleanA condition used to filter replicators in ForEach/OnNew/GetFirst/etc.
string: matches a replicator whoseNamespaceequals the string.ReplicationToken: matches a replicator whoseNamespaceequals the token's name.Tags: matches a replicator whose tags are a superset of the given tags.function: a custom predicate.
Anonymous replicators (no Namespace) never match a string or token condition
but are reachable via tags, GetFromId, ForEach(predicate), and ReplicatorCreated.
Properties
Client
This item only works when running on the client. ClientTableReplicator.Client: ClientReplicatorServer
This item only works when running on the server. ServerTableReplicator.Server: ServerReplicator