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 从公开仓库中收录这些内容。

举报或申请下架