Skip to content

Client

The client-side data API: bundle.Client. Read the local player's data through the same accessor tree as the server (Data.Coins.Get(), Data.Coins.Observe(fn)); those methods are documented on the Value class. Writes are local-only (optimistic UI). Server ops always win. To change data authoritatively, call a server command via Client.Request.

In edit mode (when RunService:IsRunning() is false, e.g. a storybook) the client skips the transport and initializes instantly to template defaults, so components render without a running server.

Lifecycle

.IsReady

client
Client.IsReady()  boolean

Whether the first Init snapshot has arrived (non-yielding). Before this is true, accessor reads return template defaults. Always true in edit mode.

.WaitForData

clientyields
Client.WaitForData(timeout: number?)  boolean

Yields until the first Init snapshot arrives, then returns true. Returns false if timeout seconds (default 30) pass first. It never hangs. Use it to gate startup logic; for reactive UI prefer Observe/Changed.

if Data.WaitForData() then
    showMainMenu(Data.Coins.Get())
end

Commands

.Request

clientyields
Client.Request(name: string, ...: any)  ...any

Calls a server command registered with Server.Command and returns its results. Yields until the reply arrives (or times out → false, "timeout"). This is the one way clients change data authoritatively.

Leaderboards

.GetLeaderboard

client
Client.GetLeaderboard(name: string, limit: number?)  { LeaderboardEntry }

The cached top-N of a replicated board (Replicate = true), streamed to clients at handshake and on change. Empty for server-only boards.

.GetMyRank

client
Client.GetMyRank(name: string)  number?

The local player's rank on a replicated board, or nil if unranked.

.OnLeaderboard

signalclient
Client.OnLeaderboard: Signal

Fires (boardName, entries) whenever a replicated board updates.

Service

.GetServiceStatus

client
Client.GetServiceStatus()  "Healthy" | "Degraded" | "Outage"

The replicated data-service health. Show players a "progress may save late" notice during a "Degraded"/"Outage".

.OnServiceStatus

signalclient
Client.OnServiceStatus: Signal

Fires with the new status whenever service health changes.

Shared Data

.GetShared

client
Client.GetShared(playerOrUserId: Player | number)  { [string]: any }?

Reads another player's Scribe.Shared roots (public info replicated to everyone), or nil if not yet received.

.OnSharedChanged

signalclient
Client.OnSharedChanged: Signal

Fires (userId, sharedData) when another player's Shared data changes.

Ownership

.Owns

clientyields
Client.Owns(key: string)  boolean

Whether the local player owns a perk or pass, from the replicated mirror. Yields until data has loaded.

.ObserveOwned

client
Client.ObserveOwned(key: string, callback: (owned: boolean) -> ())  () -> ()

Calls callback with the current ownership and again whenever it changes. Returns a disconnect function. Ideal for reactively toggling "buy" buttons.

Reads

.GetSaveInfo

client
Client.GetSaveInfo()  SaveInfo

The owner's replicated save state ({ LastSaveAt, LastResult, Dirty }) for "Saving… / Saved ✓" UI.

.Raw

propertyclient
Client.Raw: Client

The same Data object without the typed accessor tree: the untyped escape hatch if the type solver ever trips on your template.

Monetization

.GetGiftCredits

client
Client.GetGiftCredits()  { [string]: number }

The local player's unassigned gift credits by product name.

.GetPurchases

client
Client.GetPurchases(filter: { Kind: ("Robux" | "InGame")?, Category: string?, ItemId: string?, Since: number?, Limit: number? }?) → { table }

The local player's purchase history for history UI. Only returned if the game opts into replicating purchase logs (PurchaseLog.ReplicateRobux).

Edit Mode

.Mock

client
Client.Mock(values: { [string]: any }? -- template fields to seed (deep-merged), scribeState: { Perks: { string }?, GiftCredits: { [string]: number }?, Leaderboards: { [string]: { LeaderboardEntry } }? }?)

Seeds mock data for a storybook / edit mode. Errors outside edit mode. Use it to render Scribe-backed components with realistic state.

.MockCommand

client
Client.MockCommand(name: string, handler: (...any) -> ...any)

Registers a fake handler so Client.Request resolves in edit mode without a server. Errors outside edit mode.