DataStore2 data loss on disconnect

In my game all the data works perfectly fine except for when a player experiences an internet error, for some odd reason their data always gets reset to a previous version of their data but that version is extremely old and not even close to their current data. I’m not really sure how to fix this or the cause of the problem so if anyone has any ideas that’d be great :smiley:

3 Likes

DataStore2 already handles this in it’s own way, which is specifically why I am asking for help regarding to DataStore2

How frequently is data updated? Do you have a loop to periodically save/update the data as players play?

I recommend using :Save() / :SaveAll() in a loop to auto save, honestly I would just migrate to ProfileService, it’s more future proof now, the entire thing is session locked meaning it also has to do auto saves; anyhow try doing auto saves.

Are you using the GitHub version right? I hope so! Please don’t use the roblox model!

3 Likes

I agree I made the switch to profile service from datastore2 so much easier to use and I can actually have more control overall it sounds like a great solution/recommendation

1 Like

Can you provide us source that you are using DS2 from?

Never heard of this profile service before, I’ll try it out thanks

I have my own local version of DS2 that I saved a few months ago

Can you show us the script because without it we cant find the issue.

Is the disconnecting data loss fixed?

I wouldn’t know, I completely switched to ProfileService across all of my experiences

do you think it could be because the player object remains in the game while still trying to reconnect (some sort of weird functionality for roblox but I believe it exists)

A potential fix would be having a ping system where if you have not received a ping after 5 seconds for example (essentially 5000ms), save the data manually if player still exists. I was unaware this was an issue so I will plan on investigating a potential system like this

This is the only potential explanation because ds2 is supposed to save onplayerremoving, so the player object must not be removing when a internet error occurs, trying to reconnect