DataStore
Last updated
Last updated
The DataStore service allows you to load and save content that will last between game sessions. You can only save a maximum of 4MB of data to one key, and you can only perform 5 + (5 * players) operations per minute.
Function
Description
SaveVariable(Value: any, Key: string, Shared: bool?): Success: bool
Saves a variable in the datastore. Requires 2-3 arguments: Value
(any type), Key
(string), and an optional Shared
(boolean). Returns a success status as a boolean (Success
).
LoadVariable(Key: string, Shared: bool?): Success: bool, LoadedData: any
Loads a variable from the datastore. Requires 1-2 arguments: Key
(string) and an optional Shared
(boolean). Returns two outputs: Success
(boolean) indicating if the load was successful and LoadedData
(any type) with the loaded value.
SaveInstance(Model: Instance, Key: string, Shared: bool?): Success: bool
Saves an instance (model) in the datastore. Requires 2-3 arguments: Model
(of type Instance
), Key
(string), and an optional Shared
(boolean). Returns a success status as a boolean (Success
).
LoadInstance(Key: string, Parent: Instance, Shared: bool?): Success: bool, LoadedModel: Instance
Loads an instance from the datastore. Requires 2-3 arguments: Key
(string), Parent
(Instance
), and an optional Shared
(boolean). Returns two outputs: Success
(boolean) indicating if the load was successful and LoadedModel
(Instance
) representing the loaded instance/model.