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¶
Whether the first Init snapshot has arrived (non-yielding). Before this is
true, accessor reads return template defaults. Always true in edit mode.
.WaitForData¶
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.
Commands¶
.Request¶
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¶
The cached top-N of a replicated board (Replicate = true), streamed
to clients at handshake and on change. Empty for server-only boards.
.GetMyRank¶
The local player's rank on a replicated board, or nil if unranked.
.OnLeaderboard¶
Fires (boardName, entries) whenever a replicated board updates.
Service¶
.GetServiceStatus¶
The replicated data-service health. Show players a "progress may save
late" notice during a "Degraded"/"Outage".
.OnServiceStatus¶
Fires with the new status whenever service health changes.
Shared Data¶
.GetShared¶
Reads another player's Scribe.Shared roots (public info replicated to
everyone), or nil if not yet received.
.OnSharedChanged¶
Fires (userId, sharedData) when another player's Shared data changes.
Ownership¶
.Owns¶
Whether the local player owns a perk or pass, from the replicated mirror. Yields until data has loaded.
.ObserveOwned¶
Calls callback with the current ownership and again whenever it changes.
Returns a disconnect function. Ideal for reactively toggling "buy" buttons.
Reads¶
.GetSaveInfo¶
The owner's replicated save state ({ LastSaveAt, LastResult, Dirty }) for
"Saving… / Saved ✓" UI.
.Raw¶
The same Data object without the typed accessor tree: the untyped
escape hatch if the type solver ever trips on your template.
Monetization¶
.GetGiftCredits¶
The local player's unassigned gift credits by product name.
.GetPurchases¶
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.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¶
Registers a fake handler so Client.Request resolves in edit mode without
a server. Errors outside edit mode.