Roblox Server Data

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

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

Use for Roblox server or cross-server data: OrderedDataStore leaderboards, MessagingService, world state, seasons, or guilds.

AI 產生的概覽

Roblox 伺服器與跨伺服器資料的參考指引:排行榜、訊息傳遞、共享狀態與臨時協調。

功能
提供處理 Roblox 伺服器端與跨伺服器資料的參考說明。內容涵蓋 OrderedDataStore 排行榜、MessagingService 跨伺服器訊息、GlobalDataStore 共享狀態、MemoryStoreService 臨時協調、跨伺服器模式、使用者身分以及常見陷阱。產出的是指引說明,而非指令碼或檔案。
適用情境
適用於實作或偵錯 Roblox 排行榜、跨伺服器訊息、共享世界狀態、賽季或公會時。不適用於玩家持久化或 Open Cloud 相關工作。
執行需求
無需指令碼或套件,僅為說明性內容。它引用 Roblox 引擎文件,並假定處於 Roblox 開發環境。

Roblox Server & Shared Data

When to Load

Load for leaderboards, messaging, MemoryStore coordination, world state, seasons, or guilds. Player persistence: roblox-data; Open Cloud: roblox-cloud.

Quick Reference

OrderedDataStore (Leaderboards)

  • Sortable DataStore. Keys are strings (tostring(UserId)); values are integers used for sorting.
  • GetSortedAsync(ascending, pageSize, minValue, maxValue) → sorted pages
  • BatchGetAsync(keys): multi-key read, ordered stores only; missing keys are omitted
  • Budget: poll GetRequestBudgetForRequestType(OrderedWrite) before bursts (per server: 30 + numPlayers x 5 writes/min)
  • For leaderboards only, never for player saves
  • Keep the user ID a static substring in keys (player_<UserId>) so RTBF templates match; hashed keys make erasure manual

MessagingService (Cross-Server)

  • SubscribeAsync / PublishAsync; no delivery or ordering guarantee, so design for idempotency.
  • Request/response: {reqId} correlation, ack on the topic, timeout. No ack ≠ not executed — replay the same reqId, don't double-grant.

GlobalDataStore (Shared State)

  • Persistent non-player state (guilds, seasons, counters). Use UpdateAsync; never for player session data.

MemoryStoreService (Temporary Coordination)

  • Queues and sorted maps for expiring matchmaking, leases, coordination.
  • Remove a read batch only after successful, idempotent processing.
  • Sorted-map paging: last item's {key, sortKey} = next exclusive bound.

Cross-Server Patterns

  • Register servers with expiring heartbeats; use MessagingService for notifications.

User Identity

  • New code identifies users with player.User (User.Id, DomainType, DomainId); UserId stays valid. Domain IDs are per-experience, so keep cross-server keys on UserId and never mix the two.

Pitfalls

  • MessagingService: fire-and-forget, unordered, cross-server latency; not for time-critical work
  • GlobalDataStore: same rate limits as player DataStores
  • Never store Instances; serialize to primitives first; SetAsync overwrites — use UpdateAsync for shared counters

Store selection and workflows: references/full.md [blocked]

來源與署名

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

授權條款: 無授權條款

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

檢舉或申請下架