How to reset the Data Store

Think of a DataStore as a place that stores data. If you’ve followed along any of the video series, then you probably have setup the player’s leaderstats and created a function for saving the player’s data. The DataStore is where the script is directed to save this information. Within the Clicker Simulator tutorial, the DataStore is automatically created and handled using the Prof‎ileService module script. When setting this up, we create a variable called “Prof‎ileStore” and set its value to the following Prof‎‎‎‎‎ileService.GetProf‎ileStore("Production", Template).

In this scenario, the Prof‎ileStore, aka DataStore, we’re using is “Production”. So each time the script is ran with this specific Prof‎ileStore key there, it will access that DataStore. If we modify the key from “Production” to anything else, we will then be using a different DataStore. So if we change it to “Production1” and we’ve never used that DataStore before, then we’ll be using a clean DataStore which has no previous data. At any time we can go back to use the “Production” DataStore by changing the key back to “Production”.

While developing your game, it might be a good idea to include a version in the key. For example when the Prof‎ileStore is first made it can be called “Production 1.0.0”, “Development 1.0.0”, or something similar. Then each time you want to reset the Prof‎ileStore, you just increase the version number: 1.0.1, 1.0.2, 1.0.3 and so on.

IMPORTANT: When publishing your game, you need to be mindful of changing the DataStore key. If you change the DataStore key, then you’ll be using a different DataStore, so your players will not have their usual saved data. You can always revert it back to the previous key to fix this.

Contents