Datastore2 Confusion

Hello-

I am currently using DataStore2 in my game and I have run into an issue. The script has a loop that is constantly giving players cash every few minutes. For testing reasons, I give myself some cash with the following script through F9 command bar:

game.Players.MrGamingZB.leaderstats.Cash.Value = game.Players.MrGamingZB.leaderstats.Cash.Value + 500

This works, however, datastore 2 does not save this data because when I leave and rejoin the game after giving myself money, the money I had before I did the F9 script is what appears on the leaderstats UI.

Does anyone know why this would be and how I can fix it? I didn’t have this problem before.

You might be adding this on the client, it will only save if you add it on the server.

The command bar which the script goes into is under the “Server” tab in the F9 menu. Is this what you’re talking about?

Yeah, if this is a IntValue, check on the server to see if it changes.

1 Like

I would personally not use DataStore2 as it really isn’t needed. See my reply here:

Also, as for an unrelated tip, you can just do:

game.Players.MrGamingZB.leaderstats.Cash.Value += 500
1 Like