Roblox Data
When to Load
DataStore, OrderedDataStore, MemoryStore and MessagingService work: saves, quotas, leaderboards, cross-server state. Open Cloud access from outside: roblox-cloud; Studio MCP access: roblox-studio-mcp §2; client trust: roblox-security; receipt idempotency: roblox-monetization.
Traps and review checklist (symptom -> cause -> fix)
- Coins doubled or a grant applied twice ->
UpdateAsyncreruns the transform whenever another server wrote between its read and write, discarding earlier results. The transform can't yield and must be pure: no granting, remotes or counters outside it. Apply side effects after it returns. - Grant reported failed but the player got it anyway -> a failed write call means no success response reached the server, not that nothing was written (error-codes doc). Before retrying or refunding, read back with
DataStoreGetOptions.UseCache = false; key the grant by an operation id. - Studio playtest changed real player data -> with "Enable Studio Access to API Services" on, Studio (and Studio MCP
execute_luau) uses the live data stores; docs: enable it only on a separate test game. Suffix the store name underRunService:IsStudio()at least. MemoryStore is the opposite: Studio and production scopes are isolated. - Progress lost on shutdown -> all
BindToClosecallbacks run in parallel and the server waits 30 s total. Save every player concurrently (task.spawneach, then wait), not in a serial loop; calls after teardown fail with 401/402. Request was added to queuewarning, then 301-306 errors -> over the server or experience budget; each request queue holds 30, then requests drop. Gate bursts onDataStoreService:GetRequestBudgetForRequestType.UpdateAsyncspends one read and one write.KeyThrottledon one hot key -> per-key throughput is 25 MB read / 4 MB write per minute across all servers, each request rounded up to 1 KB. Shard hot shared keys; batch counter increments.- Rollback to "10 minutes ago" impossible -> a version is kept only for the first write per key per UTC hour; later writes that hour overwrite it. Superseded versions expire 30 days after being overwritten. Restore =
ListVersionsAsyncorGetVersionAtTimeAsync, then write that value (and its metadata) back as a new version. - "Deleted" data still readable ->
RemoveAsyncwrites a tombstone; old versions stay listable until they expire (matters for erasure). A data store marked for deletion keeps serving reads up to 24 h and writes for minutes; it can be restored for 30 days. - Write fails on a value that looks fine -> invalid UTF-8 byte in a string, NaN/inf, an Instance or userdata, or JSON nesting deeper than 400 (
InvalidJson). Validate before saving; one bad field fails the whole write. - Leaderboard missing history, or
MinValue must be an integer->OrderedDataStoreholds integers only, has no versioning or metadata (every write overwrites);GetSortedAsyncpages hold 1-100 entries.BatchGetAsyncworks only on ordered stores and omits missing keys. - Global ordered board lags or drops writes -> ordered writes per server default to only 30 + 5/player per minute. Batch increments per player, flush on a timer and on leave/close, keep failed writes for the next flush, cache top pages.
- MemoryStore item gone or writes failing -> it isn't durable: max expiry 45 days, and at the memory quota every write that grows usage fails (reads and deletes still work). Keep the source of truth in a DataStore; delete processed items.
- Cross-server message missed or out of order -> MessagingService is best effort, unordered, no replay;
PublishAsyncyields only until the backend has it. No ack is an unknown outcome: replay the same request id. Long-lived state goes in MemoryStore or a DataStore. - Server misses broadcasts at scale -> receive caps are game-wide and shared by every topic (§1). Prefer pull from MemoryStore over push fan-out.
- RTBF request can't be automated -> deletion templates need the user ID as a static part of the store name, scope or key (
player_{UserId};{UserId}is case-sensitive). Hashed keys force manual erasure.
1. Limits
Per minute unless noted. Read live headroom with GetRequestBudgetForRequestType instead of hardcoding.
| DataStore item | Value |
|---|---|
| Experience budget (all servers + Open Cloud, shared) | read 300 + 40×CCU, write 300 + 20×CCU, list 300 + 2×CCU, remove 300 + 40×CCU; same for ordered |
Per-server default (SetRateLimitForRequestType to change) |
read 60 + 40×players, write 60 + 40×players, list 5 + 2×players, remove 60 + 40×players |
| Per-server ordered | read 60 + 40×players, write and remove 30 + 5×players, list 5 + 2×players |
| Metadata | key 50, value 250, all pairs 300 chars total |
| Per-key throughput | 25 MB read, 4 MB write, 1 KB minimum per request |
| Storage | 500 MB + 1 MB × lifetime users; compressed latest versions only, so don't pre-compress |
| Studio Run mode | separate static limits, possibly lower; test rate limits in Team Create |
| MemoryStore (game-level, shared by all servers) | Value |
|---|---|
| Request units | 1000 + 120×CCU; GetRangeAsync/ReadAsync 1 per returned item, ReadAsync +1 per 2 s waiting, hash-map UpdateAsync ≥2, ListItemsAsync partitions + items |
| Memory | 64 KB + 1.2 KB × users; quota drops 8 days after users leave |
| Per partition | throttling from about 30,000 units; one sorted map or queue = one partition; hash-map key about 5,000 write / 15,000 read units (PartitionRequestsOverLimit) |
| Item | value 32 KB, key 128 chars, expiry max and default 45 days |
| MessagingService | Value |
|---|---|
| Message / topic | 1 kB / 1-80 chars |
| Received per topic / whole game | 40 + 80×servers / 400 + 200×servers |
| Subscriptions per server / subscribe requests | 20 + 8×players / 240 per minute |
2. What changed
| Change | Use now |
|---|---|
InvalidJson on nesting depth > 400 |
flatten recursive trees before saving |
Player.User (Id, DomainType, DomainId) |
standard identity in new code; UserId still valid and account-wide. User.Id is scoped per experience: never mix the two in one key scheme |
game.ServerRestartScheduled(restartTime, source, attributes) |
earliest restart time: flush saves and stop new rounds before shutdown |
| PlayerList Friends/Global boards (beta) | read one OrderedDataStore registered in Creator Hub, one per experience; your server writes the scores |
Player:GetFriendsWhoPlayedAsync() |
custom friend boards: fetch only friends who played this experience (user IDs), not the whole friends list, to stay inside DataStore budgets |
MemoryStore per-partition limits, Open Cloud memory-store:flush (scope=LIVE or TEST, clears every structure in it), Extended Services for paid quota |
shard hot sorted maps and keys; flush only when the game can lose all of it |
OnUpdateAsync, RemoveVersionAsync deprecated; scopes legacy |
MessagingService; key prefixes (ListKeysAsync(prefix)) for new games |
3. Value across keys
There is no multi-key transaction. A trade or gift is two writes with a crash window between them: write a transfer record (operation id, both parties, amount, state) before the first write, make each step skip if already applied for that id, and sweep pending records on start-up, or document that a crash loses or duplicates value. Acknowledge (receipt, webhook, client "done") only after the write is durable.
4. Claim-once rewards (field case)
Offline earnings: compute during load in the same UpdateAsync that stamps last-seen, so a fast rejoin can't claim twice; cap the hours, ignore short absences (server hops), pay nothing before the first real save, and derive the rate from durable progress, not the last match. Serial-numbered items: take the serial from UpdateAsync on a per-item counter before writing the copy (a failure leaves a gap, never a repeat) and key each grant by an id stored in the save.
