DataStoreService

DataStoreService : Instance

Properties

Methods

GetDataStore

The GetDataStore method retrieves a data store object that developers can use to store and manage key-value pairs. The InName parameter specifies the name of the data store, while the InScope parameter determines the scope for the data store. This method is commonly utilized when working with specific categories or subsets of data within a game. The returned data store allows for persistent and structured handling of data across game sessions.

Parameters

string InName

string InScope

Return

GlobalDataStore

Code Samples

local DataStoreService = game:GetService("DataStoreService") 
local GoldStore = DataStoreService:GetDataStore("PlayerGold")

GetGlobalDataStore

The GetGlobalDataStore method retrieves the default global data store associated with the game universe. This method does not require specifying a name or scope and is suitable for storing and retrieving common or shared data across the entire game. It is a straightforward way to handle universal data that applies to all players or components within the game.

Parameters

Return

GlobalDataStore

Code Samples

GetOrderedDataStore

The GetOrderedDataStore method retrieves an ordered data store object that maintains the keys in a specific order based on their values. This method is particularly useful for scenarios where ranking or sorted data is required, such as leaderboards or score tables. By specifying the InName and optional InScope parameters, developers can define a specific ordered data store to interact with. This tool simplifies managing and accessing ordered collections of data across game sessions.

Parameters

string InName

string InScope

Return

OrderedDataStore

Code Samples

ListDataStoresAsync

The ListDataStoresAsync method retrieves an object representing a paginated list of data stores within a game universe. This is particularly useful for retrieving metadata or identifying different data stores created in the game. By specifying the optional parameters such as InPrefix (to filter by prefix), InPageSize (to limit the number of results returned per page), and InCursor (to navigate to a specific page of results), developers can effectively manage and explore their data stores.

Parameters

string InPrefix

number InPageSize

string InCursor

Return

DataStoreListingPages

Code Samples

Events

Last updated