Skip to content

API Documentation

FrostyDragon edited this page Jun 22, 2022 · 2 revisions

DataSerializer

Properties

DataStores

dictionary DataSerializer.DataStores

A dictionary list of DataStores currently in use.

Methods

GetStore

DataStore DataSerializer:GetStore(string name, DataStoreOptions options)

Gets the data store from DataStoreService.

Defaults

  • name = "" (optional)
  • options = nil (optional)

Returns DataStore object with usable functions.


SetRetries

void DataSerializer:SetRetries(int retries, double delay)

Sets the number of retries and the time of delay (in seconds) in between retries.

Defaults

  • retries = 3 (optional)
  • delay = 2.0 (optional)

DataStore

Properties

GlobalDataStore

GlobalDataStore DataStore.GlobalDataStore

The GlobalDataStore currently being used.

Methods

Get

Folder, dictionary, variant DataStore:Get(Player plr, string key, array userids, DataStoreSetOptions options) [Yields]

Initializes/gets the data store folder for the player. If the folder does not exist, it will make a new one and parent it to the player. 
If the player does not have old data, then PresetPlayerData will be set as the new default data for the player. 
plr:SetAttribute("DSLoaded", folderName: string) is called after the player finishes loading, returns the name of Folder.

Defaults

  • plr = Player
  • key = string
  • userids = nil (optional)
  • options = nil (optional)

Returns

  • the Folder of PlayerData that is parented to the player,
  • a dictionary of serialized PlayerData,
  • DataStoreKeyInfo object if the player has played before, or Version Identifier object if the player is new.

If an error occured while retrieving Player data, then only the Folder will be returned.


Update

void DataStore:Update(Player plr, string key) [Yields]

Serializes the folder, then sends it to the Data Store.
plr:SetAttribute("IsSaving", true) is called first, while DataStore is updating data.
plr:SetAttribute("IsSaving", false) is called after the DataStore finishes updating data.

Defaults

  • plr = Player
  • key = string

CleanUpdate

void DataStore:CleanUpdate(Player plr, string key) [Yields]

Same as DataStore:Update() except it also cleans up debris from ObjectValues.
This is only recommended to use when the player is removing.
plr:SetAttribute("IsSaving", true) is called first, while DataStore is updating data.
plr:SetAttribute("IsSaving", false) is called after the DataStore finishes updating data.

Defaults

  • plr = Player
  • key = string

Remove

dictionary, DataStoreKeyInfo DataStore:Remove(string key) [Yields]

Deletes the key associated with this DataStore.

Defaults

  • key = string

Returns