gamedev-skills/awesome-gamedev-agent-skills/roblox-datastores
Claude Code and agent skill by gamedev-skills/awesome-gamedev-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Roblox DataStoreService persistence: load on join, save on leave and BindToClose, UpdateAsync vs SetAsync, session locking and OrderedDataStore leaderboards. Use for lost player data, items duplicating after teleport, or "too many requests" errors. Not for engine-neutral saves (`save-systems`), Luau basics (`roblox-luau`) or economy numbers (`roblox-simulator-economy`).
Install
npx vskill@latest install gamedev-skills/awesome-gamedev-agent-skills/roblox-datastoresSKILL.md
The same SKILL.md was published earlier as gamedev-skills/awesome-gamedev-agent-skills/roblox-datastores.
Roblox DataStores
Persist data across sessions without losing or duplicating it. All DataStore calls are network requests from server Scripts; they can fail, be throttled, and race with another server writing the same key.
Workflow
- Find the existing persistence layer. Search for
DataStoreService,GetDataStore, and any
profile or session library before writing new code. If the project already uses one, extend it; two systems writing the same key is the most common cause of rollbacks.
- Use a test place for Studio work. Studio reads and writes the same live data as players.
In a separate published test place, turn on File → Experience Settings → Security → Enable Studio Access to API Services; without it, requests fail with StudioAccessToApisNotAllowed.
- Key by `UserId`, never by name:
"Player_" .. player.UserId. - Guard every call with `pcall`. On a failed load, mark the session as not loaded and refuse
to save, so defaults never overwrite real data.
- Load on `PlayerAdded`, save on `PlayerRemoving` and in `game:BindToClose`, plus a periodic
save (every 60-120 s), never on every value change.
- Write with `UpdateAsync` and session ownership.
UpdateAsyncreads the latest value before
writing; session ownership (in references/sessions-and-limits.md) stops a stale server from writing an old snapshot over newer progress.
- Use `OrderedDataStore` only for numeric rankings (leaderboards).
- Check before reporting. Run the static check below and fix every hit. Then, with the Studio
MCP server connected and API access on in a test place, play, change a value, stop, play again, and read it back with an uncached read from execute_luau on the Server datamodel. Without MCP, ask the user to do join, change, leave, rejoin in the test place and report the value seen after rejoining and any Output warnings. Rate-limit behavior needs Team Create, not Run mode.
Patterns
Load on join
Save with UpdateAsync (session ownership still required)
This callback ignores old, so on its own it can overwrite newer progress from another server. Before shipping, add the session check from references/sessions-and-limits.md inside the callback, or use a vetted profile library.
Save on leave and on shutdown
Retry only what is safe to repeat
A failed write does not prove the write did not happen; the server may only have missed the response. Re-running an UpdateAsync that writes the full state is harmless; re-running IncrementAsync can add twice. When the outcome matters, confirm with an uncached read (DataStoreGetOptions with UseCache = false) before retrying.
Leaderboard with OrderedDataStore
Values must be integers. For a few specific players (friends, a party), BatchGetAsync(keys) reads up to 100 keys in one request instead of paging the whole board.
Gotchas
- Defaults saved over real data. A failed load treated as "new player" wipes progress on the
next save. Gate saves on "load succeeded", not on "load did not fail".
- `SetAsync` races between servers. During a teleport or fast rejoin two servers can hold the
same player; the last blind write wins. Use UpdateAsync with session ownership.
- Yields or side effects inside the `UpdateAsync` callback. The callback cannot yield, and
Roblox re-runs it when another server changed the key first, so granting items, firing remotes or incrementing counters inside it can happen twice. Act after the call returns.
- No `BindToClose` save. Players in the server at shutdown lose everything since the last
periodic save.
- Saving on every change. Throttling queues requests and then drops them with 301-306 errors.
Coalesce changes and save on a timer and on leave.
- Stale reads.
GetAsynccaches a key for about four seconds after the first read, so an
immediate re-read after a write may return the old value.
- Non-serializable values. Only JSON-like data persists: numbers, strings, booleans, and tables
with string or sequential number keys. Convert Vector3, CFrame, Color3 and Instances to plain tables first.
- Metadata and UserIds cleared on write. Once a key has metadata or UserIds, every write must
supply them again or they are removed.
- `DataStoreKeyInfo` is nil for ordered stores. They have no versioning or metadata; use a
regular DataStore when you need those.
- Temporary cross-server state. Matchmaking queues and per-round data belong in
MemoryStoreService, not DataStores.
Resources
- Read
references/sessions-and-limits.mdbefore shipping save code or when debugging rollbacks,
duplication, or throttling: session locking, versioning and metadata, pagination, request budgets, storage limits, Right to be Forgotten, and Open Cloud.
Related skills
roblox-luau: services, events, and the server/client model.roblox-simulator-economy: repairing loaded values and offline earnings.save-systems: engine-neutral serialization, slots, and migration.
Version notes
Last verified: 2026-11-11.
- Since 2026-07-29, in-game and Open Cloud requests share one per-experience budget per request
type: 300 per minute plus a per-CCU multiplier (reads 40, writes 20, lists 2 for standard and ordered stores). UpdateAsync spends from both read and write. Per-server limits still apply.
- Storage limit per experience: 500 MB + 1 MB per lifetime user, measured on the compressed latest
version of each key.
- Per key: about 25 MB per minute of reads and 4 MB per minute of writes. Value size: 4,194,304
characters. Key, store and scope names: 50 characters.
BindToClosehandlers get 30 seconds in total. Studio Run mode uses its own lower static
limits; test rate limits in Team Create.
- Automated Right to be Forgotten processing for data stores was in beta during 2026; check its
status before relying on it.
Sources: https://create.roblox.com/docs/cloud-services/data-stores, https://create.roblox.com/docs/cloud-services/data-stores/error-codes-and-limits, https://create.roblox.com/docs/reference/engine/classes/GlobalDataStore, https://create.roblox.com/docs/reference/engine/classes/DataModel (BindToClose), https://devforum.roblox.com/t/unifying-data-stores-open-cloud-and-game-apis-and-increasing-storage-limits/4739240.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/other-engines/roblox-datastores/SKILL.md
Popularity
- Repository stars
- 1,071
- Repository forks
- 87
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/gamedev-skills/awesome-gamedev-agent-skills/roblox-datastores)