SetAsync not always working

for the future, use update async to save data, you can then compare if current data is correct and if there will be error, data before player joined the game will be still here, soo no data lost, and one thing more, using loop to save data is really bad and it’s a reason, you see you can fire setAsync per key only once a 6 seconds, soo you are blocking your set async, stop doing this, instead use update async as i told to compare data and safely save it. When you save data, never use wait or something it can make game think it’s saved or not soo it glitches, i think i helped you.

Example:

local succes,err = pcall(function()

DataStore:UpdateAsync(key,
function(PastData)
if PastData.Version ~= CurrentData.Version then
return nil -- data is not safe to overwrite
else
CurrentData.Version += 1
return CurrentData -- return current data, safe to overwrite
)
end)

How to properly utilize UpdateAsync – here is article about it

1 Like