CloudStore
opens a key-value store that every server of the experience shares
Methods
1 member Access: server only
- open
(name: string) -> CloudStore open the persistent cloud store with that name
Parameters
Name Type Description name string Name of the persistent cloud store partition. returns CloudStore —
Loading Persistent Data Across Servers
Lifecycle: Server
Cloud reads are asynchronous, so the record and its version arrive in a callback.
Luau
local cloud = game.CloudStore.open("PlayerData")local function loadPlayerData(userId: number) cloud:fetch(userId, function(data, version, err) if err ~= nil then warn(string.format("Load failed for user %d: %s", userId, err)) return end local profile = data or { gold = 0, inventory = {} } print(string.format("Loaded profile for %d (v%d)", userId, version)) end)end