Hello i am using a regular datastore script and whenever i force shutdown for updates there a few people whoos data is missing. Please help
Why is my data very inconsistent?
1 answer
i have it autosave and it comes up with a problem in the autosave here is the code: while true do wait(120) if can_Save.Value == true then local success,message=pcall(function() StrengthData:SetAsync((uniquekey), {strength.Value}) RebirthData:SetAsync((uniquekey), {rebirths.Value}) OtherData:SetAsync((uniquekey), {Egg.Value,FishingDuck.Value,ChillDuck.Value,Swimming.Value,Camo.Value,Wise.Value,Evil.Value,Stone.Value,Bush.Value,Behind.Value,King.Value,Kills.Value,KingC.Value,current_duck.Value})
end)
if not success then
print("not really found dude")
wait(30)
local success,message=pcall(function()
StrengthData:SetAsync((uniquekey), {strength.Value})
RebirthData:SetAsync((uniquekey), {rebirths.Value})
OtherData:SetAsync((uniquekey), {Egg.Value,FishingDuck.Value,ChillDuck.Value,Swimming.Value,Camo.Value,Wise.Value,Evil.Value,Stone.Value,Bush.Value,Behind.Value,King.Value,Kills.Value,KingC.Value,current_duck.Value})
print("done")
end)
end
end
end
1 comment
while true do wait(120) if can_Save.Value == true then local success,message=pcall(function() StrengthData:SetAsync((uniquekey), {strength.Value}) RebirthData:SetAsync((uniquekey), {rebirths.Value}) OtherData:SetAsync((uniquekey), {Egg.Value,FishingDuck.Value,ChillDuck.Value,Swimming.Value,Camo.Value,Wise.Value,Evil.Value,Stone.Value,Bush.Value,Behind.Value,King.Value,Kill
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Can you add the script?
If you cannot, answer these questions, does it autosave every X seconds or does it save with a button/command/ when the player leaves. Or is it a datastore issue that you can fix with pcall?