Datastore issues: Saves randomly rolling back to a save from 2 servers ago?

So i have heard that a few players are losing their savedata randomly and according to what they tell me, it looks like the saves are rolling back to a previous save from 2 servers ago.

Someone described everything he did to me:

So I had an Old Boat in Slot 1… I deleted that boat and saved NOTHING to slot 1 (Basically I cleared Slot 1) I deleted the Boat and the name of the Boat which was Ironclad. I built a Submarine and Saved it to Slot 1 (I built the Submarine on a NON PVP Server), I switched servers sometimes and all was fine, I kept working on the submarine and when I was almost done I switched to a PVP server via the Gamemode button in the right corner. I joined on a PVP server where I found my friend, I spawned my Submarine and left (While the submarine was still spawned) and played Bad Business on Roblox for 5 minutes, I then joined the SAME PVP server as before because I joined Plane Crazy through following my friend in-game. My Submarine I saved was now my Old Boat again, it even had the old name Ironclad, my Auto Save slot was an Destroyer, I had recently played with. So Slot 1 was put back to the Old Boat and the AutoSave was a random destroyer I recently played with and my Submarine was gone, (What should be noted was that I painted my destroyer before building my Submarine and the paint was now gone too, on the Autosave as well as on Save Slot 5 where I saved my Destroyer Painted…) anyways I rejoined (again through following my friend in the game) and it was still the Old Boat and not my submarine, I clicked Undo but it just deleted my Old boat so I clicked Undo again and my Old Boat was there. I then joined Plane crazy via normal (Planecrazy Roblox click the play button) but the problem still was there, my Old boat was on Slot 1 and my Submarine was gone.

The same thing happened to the rest of the players, they were a few servers ahead already and lost 3 hours of playtime because the savedata got rolledback from a server they were in a few servers ago.

I see no errors and no issues in my scripts, everything should work normally, its just really rare situations like these where people lose their data.

What might cause this and what should i do?

3 Likes

Incorrect usage of :Set would do it I think.

Can we see your data saving and loading code?

--loading
local StoredPlayerData = PlayerDataStore:GetAsync(Player.UserId)
-- everything from the StoredPlayerData is set into the sessiondata, but its too much to show

--------------------------------------------------------------
--saving
local SaveTable = {
				TComp2 = SessionData[playername].TutComplete,
				AutSave = SessionData[playername].AutSave,
				Sounds = SessionData[playername].Sounds,
				Particles = SessionData[playername].Particles,
				RagDollKey = SessionData[playername].RagDollKey,
				ParachuteKey = SessionData[playername].ParachuteKey,
				JetpackKey = SessionData[playername].JetpackKey,
				RGBsave = SessionData[playername].RGBsave,
				DayTime = SessionData[playername].DayTime,
				LimitedItems = SessionData[playername].LimitedItems,
				JoinedFirst5 = SessionData[playername].JoinedFirst,
				SlotAuto = SessionData[playername].SlotAuto,
				TimePlayed = SessionData[playername].TimePlayed,
				InfiniteFuel = SessionData[playername].InfiniteFuel,
				turnedfueltrue = SessionData[playername].turnedfueltrue,
				Photomode = SessionData[playername].Photomode,
				ToggleArrow = SessionData[playername].ToggleArrow,
				ParColor = ParColor2,
				
				Slot1 = SessionData[playername].Slot1,
				Slot2 = SessionData[playername].Slot2,
				Slot3 = SessionData[playername].Slot3,
				Slot4 = SessionData[playername].Slot4,
				Slot5 = SessionData[playername].Slot5,
				Slot6 = SessionData[playername].Slot6,
				Slot7 = SessionData[playername].Slot7,
				Slot8 = SessionData[playername].Slot8,
				Slot9 = SessionData[playername].Slot9,
				Slot10 = SessionData[playername].Slot10,
				Slot11 = SessionData[playername].Slot11,
				Slot12 = SessionData[playername].Slot12,
				Slot13 = SessionData[playername].Slot13,
				Slot14 = SessionData[playername].Slot14,
				Slot15 = SessionData[playername].Slot15,
				Slot16 = SessionData[playername].Slot16,
				Slot17 = SessionData[playername].Slot17,
				Slot18 = SessionData[playername].Slot18,
				Slot19 = SessionData[playername].Slot19,
				Slot20 = SessionData[playername].Slot20,
				Slot21 = SessionData[playername].Slot21,
			}
			PlayerDataStore:SetAsync(userid,SaveTable)```

Use update async instead. Set async can lead to losses like this.

Alternatively, use datastore2 instead which really helps with avoiding data loss issues.

2 Likes