PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetAsync

This function returns the value of the entry in the GlobalDataStore with the given key. If the key does not exist, returns nil. This function caches for about 4 seconds, so you cannot be sure that it returns the current value saved on the Roblox servers.

If this function throws an error, the Articles/Datastore Errors|error message will describe the problem. Note that there are also Articles/Datastore Errors|limits that apply to this function.

To save a data store entry, you can use one of several possible functions, including GlobalDataStore/SetAsync|SetAsync(), GlobalDataStore/UpdateAsync|UpdateAsync(), and GlobalDataStore/IncrementAsync|IncrementAsync().

Parameters

Name Type Default Description

key

The key identifying the entry being retrieved from the data store

Returns

Return Type Summary

The value of the entry in the data store with the given key


Code Samples


Data Store to Leaderboard

This code sample retrieves a player’s saved gold from a data store and puts the returned value onto the leaderboard. Note that this sample does not save players’ gold — it only loads it.