Server API
Cross
Cross-server messaging and shared state in one module. Publish and subscribe to real-time events across every server in your game via MessagingService, and read/write persistent shared data across servers via MemoryStoreService — with a built-in server registry on top.
Import
local Cross = RoExpress.Cross
Cross is server-only. MessagingService and MemoryStoreService are unavailable on the client. Calling Cross from a LocalScript will throw.
core
Messaging
Publish events to all servers. Subscribe persistently or once. Handlers receive the payload plus the origin server ID and timestamp.
Cross.Publish · Cross.Subscribe · Cross.Once · Cross.Unsubscribe
→
state
Shared Memory
Key-value store visible to all servers. Set, get, remove, and atomic update. Backed by MemoryStoreService with automatic JSON encoding.
Cross.Memory.Set · .Get · .Remove · .Update
→
registry
Server Registry
Register this server so other servers can discover it. Includes a heartbeat that refreshes the entry every 30 seconds and removes it when the server closes.
Cross.RegisterServer · .GetServers · .UnregisterServer · .ServerId
→
At a glance
local Cross = RoExpress.Cross
-- register this server so others can find it
Cross.RegisterServer({ mode = "pvp", map = "Forest" })
-- broadcast a message to all servers
Cross.Publish("round.end", { winner = "Player1" })
-- receive messages from any server
Cross.Subscribe("round.end", function(data, ctx)
print(ctx.serverId, "ended round, winner:", data.winner)
end)
-- shared global counter
Cross.Memory.Update("stats.wins", function(n) return (n or 0) + 1 end)
local wins = Cross.Memory.Get("stats.wins")
-- list every live server
local servers = Cross.GetServers()
print(#servers, "servers online")
Roblox service limits
| Service | Limit |
|---|---|
| MessagingService publish | 150 messages/min per server · 600 messages/min per game |
| MessagingService message size | 1 024 bytes per message |
| MessagingService subscriptions | 5 active topics per server |
| MemoryStore requests | 1 000 + 100 × player count per minute, per server |
| MemoryStore value size | 32 KB per key |
| MemoryStore key TTL max | 45 days |
See also
Bridge | same-server event bus · Hook | Roblox signal dispatcher · RTTP | outbound HTTP to external services