Skip to content

Shared Session Functions ​

SharedSession is server-wide temporary state replicated to every client in the current server. It uses a separate Replica from per-player profile data. Client read APIs wait until the shared Replica is ready, similar to profile reads.

See Shared Session and Data visibility.

GetShared() ​

GetShared(key: string) → any

Reads a top-level shared key. Use GetSharedPath if you need dot paths.


GetSharedPath() ​

GetSharedPath(path: string) → any

Reads a nested value using dot notation.


OnSharedChanged() ​

OnSharedChanged(pathOrKey: string, callback) → ReplicaClient.Connection?

Listens for SharedSession updates.


GetSharedReplica() ​

GetSharedReplica() → ReplicaInstance?

Raw SharedSession Replica for advanced subscriptions.


GetSharedAll() ​

GetSharedAll() → table?

Full SharedSession table when ready.


IsSharedReady() ​

IsSharedReady() → boolean

Whether SharedSession is ready on this client.

Example
lua
local endsAt = PlayerState.GetSharedPath("round.endsAt")

PlayerState.OnSharedChanged("round.phase", function(newPhase)
    print("Round phase:", newPhase)
end)

PlayerState - High-Performance Roblox Data Management