You are able to enable Roblox Studio access to API services allows you to use Data Store from the Roblox Studio. Data stores are the name of the storage feature for Roblox games. They are all used to save data which should persist between game sessions, including items in the inventory of the player, experience points, or almost anything else. Per game, data stores are shared, so any place in the game, including places in different servers are able to access and change the same data.
How is the structure of data store? Just like a Lua table, this one is essentially a dictionary. Every value in it is able to be indexed by the unique key that includes the UserId of the player. For instance: the key Player_1234 has 50 value, the key Player_2345 has 20 value, the key Plater_7462 has 78000 value, the key Player_8934 has 1200 value, and the key Player_10345 has 0 value.
Apparently, data stores are managed by DataStoreService. It means your services must get the service before doing much else. Once you have included DataStoreService in the script, the data store can be accessed by the name using the GetDataStore() function. Do not forget that data stores can only be accessed by the server through scripts. Trying client side access in the local script will cause an error.
How to manage a data store? Managing a data store includes setting data, reading data, incrementing data, updating data, and removing data. SetAsync() will set the value of the new data store entry. This one needs the key name of the entry and the value to set. The GetAsync() function will read the value of the data store entry. This one needs just the key name of the entry.
How to use data stores in Roblox Studio? By default, all the places simulated in Roblox Studio do not have the access to data stores, so any request function such as SetAsync() or GetAsync() will cause an error if called from Roblox Studio. If wanted, the data store is able to be enabled in Roblox Studio as follows. From the Home tab, the first thing that you have to do is to open the Game Settings window. In the Options section, you need to turn on “Enable Studio Access to API Services”. After that, click Save in order to register your changes.
Please keep in mind that accessing data stores in Roblox Studio can be dangerous for live games. The main reason behind it is because Roblox Studio accesses the same data stores as the client application. In order to avoid overwriting production data, you have to not to enable the setting for live games. Instead, you need to enable it for a separate test version of the game.
In case you are not editing a place through the official website of Roblox, for instance a local, .rbxl file, you will have to call SetPlaceId() in the Command Bar before the in Roblox Studio game can access the data store.