Roblox Wiki
Advertisement
Roblox Wiki

Data persistence is a method for saving data from one game session to another. The data is saved on the player, and to the place, which means that you can't use the data between games and that the player that got saved data must be in a server for the server to be able to load the data.

A way to save data between games is to use badges, but it is really complicated and one-way based.

Data Persistence is functions in the Player object.

:WaitForDataReady() 
:LoadBoolean(String key) 
:LoadNumber(String key) 
:LoadString(String key) 
:LoadInstance(String key) 
:SaveBoolean(String key,Bool value) 
:SaveNumber(String key,Number value) 
:SaveString(String key,String value) 
:SaveInstance(String key,Object value)

:WaitForDataReady()

Used to make sure all data is ready, use this before any other Data Persistence code!

:Load[Type](String key)

:LoadBoolean(String key) 
:LoadNumber(String key) 
:LoadString(String key) 
:LoadInstance(String key)

Load data of the given type from the given key in the player.

:Save[Type](String key,[Type] value)

:SaveBoolean(String key,Bool value) 
:SaveNumber(String key,Number value) 
:SaveString(String key,String value) 
:SaveInstance(String key,Object value)

Saves data of the given type to the given key in the player.

Restrictions

As said the saved data is tied to a game and a player. It might be a 45000 byte storage limit (it is suggested in the official wiki)

Trivia

This section is a trivia section. Please relocate any relevant information into other sections of the article.

  • Some people lost their data playing games that used Data Persistence between May 28 and May 29 of 2014. The lost data was never recovered.[1]
Advertisement