Module · Scripting core
net.state
Values the server sets and every player receives automatically — including players who join later. Clients read; only the server writes.
net.state.all(): any
Every key and value.
net.state.get(key: string): any
The current value of a key, or nil.
net.state.onChanged(handler: function): Subscription
Calls handler(key, value) whenever a value changes (on clients also once per key when the snapshot arrives).
net.state.set(key: string, value: any)
server onlyneeds net
Sets a replicated value; nil removes it.
net.state.set("round", { number = 2, endsAt = time.unix() + 120 })net.state.watch(key: string, handler: function): Subscription
Calls handler(value) whenever one key changes.
net.state.watch("round", function(round) showRound(round.number) end)