Datastore2 question

Hi! I got a question related to datastore2 module and its storing.
So lets look at those two examples:

  1. I run this loop on the first lines of script:
local datastore2 = require(1936396537)
datastore2.Combine("DATA", "money","","","") -- (many more keys)
while wait(2) do
		datastore2("money", game.Players.nuttela_for1me):Increment(1000, 0)
		wait(0.5)
		print(datastore2("money", game.Players.nuttela_for1me):Get())
	end
end	

prints are doing as aspected and data gets saved, when I join the game again, it starts from where I finished.
2. Doing the same loop after PlayerAdded event

local datastore2 = require(1936396537)
datastore2.Combine("DATA", "money","","","") -- (many more keys)
game.Players.PlayerAdded:Connect(function(plr)
    while wait(2) do
		datastore2("money", game.Players.nuttela_for1me):Increment(1000, 0)
		wait(0.5)
		print(datastore2("money", game.Players.nuttela_for1me):Get())
	end
end)	

At this type of looping prints are doing as aspected, so I could suspect that the data is actually updating and saving, but no! When I rejoin it starts from 0, so that means that data wasnt actually saved once I left the game… and this also occurs if I try with RemoteEvents instead of PlayerAdded event.
Thanks for help!

dont use require to get the datastore2 module, that one is not the latest version

Release DataStore2 v1.3.0 · Kampfkarren/Roblox · GitHub ← this is

not sure if that will fix it, so let us know

Thanks for the reply, I set up the module but anything has changed :frowning:

Are you testing in-studio or in the published place? If it’s in studio you have to add the “SavOnStudio” Value, and be sure “Enable Studio Access to API Services” is turned on.

Yeah I test this in official servers, anyways I discovered that, the bugg only occurs in this place/game. I tested it out in other place and it worked as aspected, which is kinda weird. I was checking if there is any other datastore setting up in my place with search all scripts feature, but didnt find any…

try a diferent total random key
and dont combine the new key

show us a picture of your output as well after you stopped testing

wow it works, are u magician or sth? :smiley: anyways I would still appriciate the explaination of my messed up datastore keys, maybe the amount of keys?

you said many keys.

im not sure how many. but datastores have a limit on how much data can be in 1 key.(its large but can be filled)

other option would be to use the “- OnUpdate(callback)” option
every time a datastore updates you can let it run a print to see if something resets it.

keep in mind we have just narrowed down what it can be, not found the cause.

you should still combine your keys if posible