Store
a store kept with the place, so its rows survive a restart
Methods
2 members
- get
(key: number | string): {[string]: any}? retrieve the record stored under key, or nil if no entry exists
Parameters
Name Type Description key number | string Key identifying the record to retrieve. - put
(key: number | string, value: {[string]: any}): () write a table record under the given key
Parameters
Name Type Description key number | string Key identifying the record to store. value {[string]: any} Table of fields to persist in the record.
Saving and Loading Key-Value Records
Lifecycle: Server
A store is opened by name, then written and read with ordinary Luau tables.
Luau
local store = game.Store.open("Inventory")store:put("slot_1", { item = "Compass", quantity = 1 })local data = store:get("slot_1")if data then print("Retrieved item:", data.item)end Output: Retrieved item: Compass