Skip to content

77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.

fix(roblox): datastore load gate, Studio access path and current limits

Kiro Crewd7d1056ea9d3
diff --git a/skills/other-engines/roblox-datastores/SKILL.md b/skills/other-engines/roblox-datastores/SKILL.md
index c3bf08e..1043dac 100644
--- a/skills/other-engines/roblox-datastores/SKILL.md
+++ b/skills/other-engines/roblox-datastores/SKILL.md
@@ -29,9 +29,10 @@ memory stores (a different service). Engine-agnostic persistence theory →
## Core workflow
-1. **Enable Studio access once.** File → Game Settings → Security → *Enable Studio
- Access to API Services* (use a test place; Studio hits live data). DataStores
- work only from server `Script`s, never `LocalScript`s.
+1. **Enable Studio access once.** In a published place, File → Experience Settings →
+ Security → *Enable Studio Access to API Services* (use a separate test place; Studio
+ hits the same live data as players). DataStores work only from server `Script`s,
+ never `LocalScript`s.
2. **Get a store, then read/write by key.** `DataStoreService:GetDataStore("Name")`;
key per player is usually `"Player_" .. player.UserId`.
3. **Wrap every call in `pcall`.** `GetAsync`/`SetAsync`/`UpdateAsync` are network
@@ -79,9 +80,12 @@ end)
```lua
-- UpdateAsync reads the latest value, then writes what the callback returns.
--- The callback MUST NOT yield (no task.wait, no further Async calls inside it).
+-- The callback MUST NOT yield (no task.wait, no further Async calls inside it), and it
+-- can run more than once if another server writes the key first, so keep it pure.
local function savePlayer(player)
- if player:GetAttribute("DataLoaded") == false then return end -- never overwrite on a bad load
+ -- Save only after a confirmed load. `~= true` also covers a player who leaves while
+ -- GetAsync is still in flight (attribute still nil), which `== false` would miss.
+ if player:GetAttribute("DataLoaded") ~= true then return end
local key = "Player_" .. player.UserId
local newData = gatherDataFor(player) -- a plain table of serializable values
@@ -101,7 +105,7 @@ end
Players.PlayerRemoving:Connect(savePlayer)
-- BindToClose runs when the server shuts down; save everyone still in.
--- It has a limited time budget, so save in parallel and yield until done.
+-- The server waits at most 30 seconds for it, so save in parallel and yield until done.
game:BindToClose(function()
local players = Players:GetPlayers()
local remaining = #players
@@ -132,6 +136,12 @@ end
local ok, data = withRetry(function() return store:GetAsync(key) end)
```
+Retry only operations that are safe to repeat. A failed write is not proof the write did
+not happen: the server may simply have missed the response. Re-running an `UpdateAsync`
+that writes the full saved state is harmless; re-running `IncrementAsync` can add twice.
+When the outcome matters, confirm it with an uncached read (`DataStoreGetOptions` with
+`UseCache = false`) before retrying.
+
### 5. Increment a counter
```lua
@@ -168,17 +178,23 @@ end
each other. Use `UpdateAsync` for read-modify-write so each write sees the latest.
- **Yielding inside the `UpdateAsync` callback** → the callback can't call
`task.wait` or other Async functions; compute the new value beforehand and return it.
+- **Side effects inside the `UpdateAsync` callback** → Roblox re-runs the callback when
+ another server changed the key between read and write, so granting items, firing
+ remotes, or incrementing counters there can happen twice. Act after the call returns.
+- **Saving a player who left mid-load** → `PlayerRemoving` can fire while `GetAsync` is
+ still yielding. Gate saves on "load succeeded", not on "load did not fail".
- **No `BindToClose` save** → players in the server at shutdown lose unsaved progress;
add `game:BindToClose` and wait for saves to finish within its budget.
- **Throttling / "too many requests"** → respect per-key and per-minute limits; don't
save on every value change. Batch and save on a timer / on leave. `GetAsync` is
- cached briefly, so immediate re-reads may be stale.
+ cached for about four seconds, so immediate re-reads may be stale. Studio Run mode
+ uses its own lower static limits; Roblox recommends testing rate limits in Team Create.
- **Storing non-serializable values** → only JSON-serializable data persists: numbers,
strings, booleans, and tables with string/number keys. `Instance`s, `Vector3`,
`CFrame`, and functions do not — serialize them to plain tables first.
-- **Testing without API access** → DataStores silently can't be used in Studio until
- *Enable Studio Access to API Services* is on (and they don't work from a
- `LocalScript`).
+- **Testing without API access** → DataStore requests in Studio error (writes report
+ `StudioAccessToApisNotAllowed`) until *Enable Studio Access to API Services* is on (and
+ they don't work from a `LocalScript`).
- **`DataStoreKeyInfo` is nil for ordered stores** → `OrderedDataStore` doesn't
support versioning/metadata; use a regular `DataStore` when you need those.
diff --git a/skills/other-engines/roblox-datastores/references/sessions-and-limits.md b/skills/other-engines/roblox-datastores/references/sessions-and-limits.md
index 169bfc1..885edda 100644
--- a/skills/other-engines/roblox-datastores/references/sessions-and-limits.md
+++ b/skills/other-engines/roblox-datastores/references/sessions-and-limits.md
@@ -46,8 +46,10 @@ end
```
Important: when you set metadata or UserIds, you must re-supply them on every write
-or they're cleared. List past versions with `ListVersionsAsync` and fetch one with
-`GetVersionAsync` to recover from a bad write.
+or they're cleared. In `UpdateAsync`, the callback receives `(currentValue, keyInfo)` and
+returns up to `(newValue, userIds, metadata)`; return `keyInfo:GetUserIds()` and
+`keyInfo:GetMetadata()` when you are not changing them. List past versions with
+`ListVersionsAsync` and fetch one with `GetVersionAsync` to recover from a bad write.
A `schema`/version number stored alongside the data lets you **migrate** old saves:
on load, if `data.schema < CURRENT`, transform the table forward before use.
@@ -70,8 +72,14 @@ if ok then
end
```
-`GetSortedAsync(ascending, pageSize, minValue?, maxValue?)` — page size caps how
-many entries `AdvanceToNextPageAsync` fetches per request.
+`GetSortedAsync(ascending, pageSize, minValue?, maxValue?)` — page size (1–100) caps how
+many entries `AdvanceToNextPageAsync` fetches per request; `minValue`/`maxValue` must be
+integers.
+
+To show specific players' scores (friends, a party) without paging the whole board, read
+up to 100 keys in one request with `boards:BatchGetAsync(keys)`. It is supported only on
+ordered stores, returns a dictionary of `key → { value = n }`, omits missing keys, and
+each requested key counts against the ordered read budget.
## Request limits & throttling
@@ -88,10 +96,18 @@ many entries `AdvanceToNextPageAsync` fetches per request.
with `GetRequestBudgetForRequestType`.
- Storage is a GAME-level limit, not per-key: total = 500 MB + 1 MB x lifetime user count
(any user who has ever joined), measured on the compressed latest version of each key.
- Superseded versions and deleted keys do not count toward it.
-- `GetAsync` results are cached for a short window — an immediate re-read returns the
- cached value, not necessarily the freshest. Disable caching only if you truly need
- to (it costs extra requests).
+ Superseded versions and deleted keys do not count toward it. Store plain data; Roblox
+ compresses it, so pre-compressing only adds CPU cost.
+- Per entry: store, key, and scope names are at most 50 characters; a value is at most
+ 4,194,304 characters of serialized JSON (measure with `HttpService:JSONEncode`).
+ Per key across all servers: about 25 MB/minute of reads and 4 MB/minute of writes,
+ rounded up to the next KB per request. A hot shared key throttles as `KeyThrottled`
+ even when the experience budget has room.
+- A failed write call does not prove the write was not applied; verify with an uncached
+ read before retrying a non-idempotent operation.
+- `GetAsync` results are cached for about four seconds — an immediate re-read returns the
+ cached value, not necessarily the freshest. For a verification read after a write, pass
+ a `DataStoreGetOptions` with `UseCache = false` (it costs a real request).
- Practical rules: save on leave / `BindToClose` and on a periodic timer (e.g. every
60–120s), **not** on every value change. Coalesce many small changes into one
write. Use `UpdateAsync` so concurrent writers don't clobber.