The server might not have been able to save the data properly if they spawned in a bunch of models to the point it crashed. It could have totally messed it up so now they all have default values. Is there a way you can get a backup of the data?
A useful thing to do: (mainly for values that always increase and never decrease)
if currentStat > savedStat then
--> save currentStat
elseif currentStat < savedStat then
--> update currentStat with savedStat
else
--> do nothing because number didn't change.
end
If you store everything in tables then check values inside the tables.
If values dont exist, create it. (For cases where new stats are added and players load old data)
Also save player data to a backup datastore using tick() to determine if it was already backed up that day.
I think the model the exploiter added could have messed up the server scripts that handle saving the game, or another thing was that the exploiters model had scripts inside that could reset stats. I’m guessing by losing stats you mean everything got reset. So if I were you I would really just beef up my anti-exploits and make accessing data a lot more difficult.
Also im not entire sure if this is the case or not, but I have found that it player data inside tables is more reliable when you are going based on the player’s name or userid and not the player object itself. Because if the player leaves the server, you would assume the table reference also gets removed, thus the reason for some stat issues. I am not sure if thats truly the case, but since ive been doing playerdata[tostring(player)] or playerdata["id"..player.UserId] ive had no issues with player data inside tables since. But just make sure you set the player’s data table to nil when you are done needing it otherwise it will stay in memory and players can rejoin and the old stats will still be there.
Converting the ModuleScript based on the link in my original post to use player.Name seems exactly the problem. If the player object is nil before PlayerRemoving can fire, then it’ll be nil. And thus be trying to access sessionData[nil].
At least, that’s what I’m assuming is the problem.
@Dev_Ryan yes, all of the data is currently saved inside tables. I suppose I could just use UpdateAsync for this?
Huh, recently just came across somebody who crashed and lost 5k robux worth of their currency. They were able to prove it, so I gave them the money back.
Interestingly enough, I checked their saved data for developer products bought (in a different data store), and that saved just fine.
So switching to sessionData[player.Name] didn’t solve the problem. And I have no idea why it’s not saving. Since it autosaves player data every 60 seconds, it should work fine…