OfflineSaveSlots
A player's save slots opened without that player, and the obligation to close them again.
Wraps a borrowed PlayerDataStoreHandle and a HasSaveSlotsDataStore built over it, so admin tooling can act on someone who is not in this server. Destroying this releases the session -- see PlayerDataStoreHandle for why that matters, and SaveSlotService.PromiseOfflineSaveSlots for how one is opened.
WARNING
Opening this steals the player's session lock, which kicks them from wherever they were playing. It is for admin tooling acting on an absent player; never open one for a player who is in this server -- use their bound HasSaveSlots instead, or you will be writing to a second, stale copy of their data.
The value objects backing the slot state are detached rather than replicated: there is no player to replicate to, and the slot roster stays unparented for the same reason.
local offline = saveSlotService:PromiseOfflineSaveSlots(userId):Yield()
local slots = offline:GetSlotsDataStore()
print(slots:GetSlotList())
offline:Destroy()
Functions
new
Types
interface OfflineSaveSlotsOptions {SharedDataStoreService: any--
SaveSlotSharedDataStoreService
MaxSlotCount: numberCodeGenerator: SaveSlotCodeUtils.CodeGenerator?UserId: number?UserName: string?}Builds the slot system over a borrowed datastore handle. Takes ownership of the handle: destroying this destroys it.
isOfflineSaveSlots
OfflineSaveSlots.isOfflineSaveSlots(value: any) → booleanReturns whether the value is an OfflineSaveSlots.
PromiseSlotsLoaded
Resolves once the slots have loaded from the datastore.
GetSlotsDataStore
Returns the slot system, a HasSaveSlotsDataStore. Valid until this is destroyed.
Destroy
Tears the slot system down and releases the borrowed session, which saves and unlocks it so the player can rejoin. Destroying twice is safe.