Roblox Data

TabooHarmony/roblox-brain/skills/core/roblox-data

作者 TabooHarmony38826be57ee37bcf023e9c2b85681bea3909281c無授權條款收錄於 2026年10月9日更新於 2026年10月9日

Use when implementing player data persistence with DataStore, session ownership, schemas, migrations, or save and load flows.

AI 產生的概覽

指導 Roblox 玩家資料持久化,涵蓋 DataStore、工作階段歸屬、結構定義、移轉以及儲存與載入流程。

功能
此技能為在 Roblox 體驗中實作玩家資料持久化提供參考指引。內容涵蓋定義帶版本欄位的可序列化範本、使用 UpdateAsync 進行讀取-修改-寫入、避免並行工作階段同時修改、在生命週期邊界儲存、驗證儲存值,以及處理被遺忘權(RTBF)的鍵值配置。它也會指向一份更完整的持久化工作流程參考文件。
適用情境
適用於實作或審查 Roblox 玩家儲存與載入系統、資料結構定義、移轉、重試、關閉處理或工作階段歸屬的情境。它著重於以 DataStore 為基礎的持久化,而非排行榜、訊息、世界資料或 Open Cloud。
執行需求
沒有指令碼,僅為說明性內容。它假定處於具備 DataStore 存取權的 Roblox 開發環境,並引用一份額外的模型可讀參考檔案。

roblox data persistence

When to Load

Load for player saves, migrations, retries, shutdowns, or session ownership. Leaderboards/messaging/world data: roblox-server-data; Open Cloud: roblox-cloud.

Quick Reference

  • Define a serializable template and a version field before storing player state. Deep-copy templates so nested defaults are not shared; migrate, then reconcile missing fields against the template. Scope store names by environment (PlayerData_Studio) so Studio writes stay out of production.
  • Use UpdateAsync for read-modify-write; handle throttling and transient errors.
  • Prevent two servers mutating one profile at once: a session-ownership wrapper or equivalent protocol.
  • With ProfileStore: StartSessionAsync, Profile.OnSessionEnd, EndSession as documented; no Steal for normal loads; ProfileStore.Mock for ephemeral Studio writes.
  • Save on meaningful changes and lifecycle boundaries; PlayerRemoving alone is not sufficient. BindToClose finishes pending work.
  • Store primitives, arrays, dictionaries; convert Instances/userdata/functions/cyclic tables first. Validate numbers (no NaN/inf), strings (utf8.len), nested tables: one bad value fails the write.
  • RTBF: keep the user ID as a static substring in keys (player_<UserId>) so {UserId} deletion templates can match; hashed or random keys make erasure manual.
  • GetAsync serves a 4-second local cache (DataStoreGetOptions.UseCache, default true); verify writes with UseCache = false.
  • Poll DataStoreService:GetRequestBudgetForRequestType for live headroom; quotas scale with concurrent users (experience reads: 300 + concurrentUsers x 40/min).
  • New code identifies users with player.User (User.Id, DomainType, DomainId); UserId remains valid, but never mix the two IDs in one key scheme.

Persistence workflows: references/full.md [blocked]

來源與署名

來源:TabooHarmony/roblox-brain位於skills/core/roblox-data提交38826be

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架