Datastore2 Data Lose Issue

I recently released a game called Slayer’s Legacy. I never had issues when we were testing the game with our friends but we didn’t really have any issues with datastore in testing. When we released the game we started to have so many reports because of data lose.

This is how i save the data:

local players = game:GetService("Players")

local DataStore2 = require(game:GetService("ServerScriptService"):WaitForChild("MainModule"))
local mainKey = "Data-7"
DataStore2.Combine(mainKey, "Stats")

local function setDataTable()
	local userData = {
		["BreathLvl"] = 1,
		["FaceId"] = 0,
		["IsDemon"] = false,
		["JP"] = 57.5,
		["WS"] = 17,
		["Karma"] = 0,
		["EXP"] = 0,
		["Style"] = "Nothing",
		["HasSkill1"] = false,
		["HasSkill2"] = false,
		["HasSkill3"] = false,
		["Rank"] = 0,
		["EquippedKatana"] = "Nothing",
		["HandleColor"] = "Nothing",
		["Handle2Color"] = "Nothing",
		["BladeColor"] = "Nothing",
		["FinalSelection"] = false,
		["Money"] = 0
	}
	return userData
end

players.PlayerAdded:Connect(function(plr)
    local status = plr:WaitForChild("Status")
	local stats = plr:WaitForChild("Stats")
	local mood = plr:WaitForChild("Mood")
	
	local blocking = status:WaitForChild("Block")
	local stunned = status:WaitForChild("Stunned")
	local breathing = status:WaitForChild("Breath")
	local IsEquipped = status:WaitForChild("IsEquipped")
	local died = status:WaitForChild("Died")
	
	local EquippedKatana = stats:WaitForChild("EquippedKatana")
	local breathlvl = stats:WaitForChild("BreathLvl")
	local faceId = stats:WaitForChild("FaceId")
	local handleColor = stats:WaitForChild("HandleColor")
	local handle2Color = stats:WaitForChild("Handle2Color")
	local bladeColor = stats:WaitForChild("BladeColor")
	local isDemon = stats:WaitForChild("IsDemon")
	local style = stats:WaitForChild("Style")
	local hasSkill1 = stats:WaitForChild("HasSkill1")
	local hasSkill2 = stats:WaitForChild("HasSkill2")
	local hasSkill3 = stats:WaitForChild("HasSkill3")
	local exp = stats:WaitForChild("EXP")
	local karma = stats:WaitForChild("Karma")
	local rank = stats:WaitForChild("Rank")
	local finalSelection = stats:WaitForChild("FinalSelection")
	local money = stats:WaitForChild("Money")
	
	local userData
	local dataTable
	local isDataLoaded = false
	spawn(function()
		userData = DataStore2("Stats", plr)
		dataTable = userData:GetTable(setDataTable())
		
		for i,v in pairs(stats:GetChildren()) do
			v.Value = dataTable[v.Name]
			v.Changed:Connect(function()
				dataTable[v.Name] = v.Value
				userData:Set(dataTable)
				
				if v.Name == "Rank" then
					updateRank(plr)
					updateClothes(plr, hasCustomClothes)
				end
			end)
		end
		
		if faceId.Value == 0 then
			faceId.Value = faceTable[math.random(1, #faceTable)]
		end
		if handleColor.Value == "Nothing" then
			handleColor.Value = tostring(BrickColor.Random())
		end
		if handle2Color.Value == "Nothing" then
			handle2Color.Value = tostring(BrickColor.Random())
		end
		if bladeColor.Value == "Nothing" then
			bladeColor.Value = tostring(BrickColor.Random())
		end
		
		isDataLoaded = true
		
		updateRank(plr)
	end)
end)

I had the same problem in my game. datastore2 is not saved due to the global player table, it just uses GetOrderDataStore, as in datastore2. When I turned off the script in the global player table, people no longer complained about this problem.

What do you mean by global player table?

Yes, I mean the global player table

I mean im asking what is it and what does it do?

This shows the best players who have more coins, for example.Screenshot by Lightshot

I don’t have a global leaderboard.

im not seeing the issue, and you said this was working fine before the player increase/release?

eh, i honestly would just recommend handling datastores yourself and saving tables to it instead of single values for each datastore. (it takes time to learn and understand but its possible to create it yourself without data loss), datastore2 is just a redundant layer over the datastore service, and tbh its harder to learn datastore2 then it is to learn datastore service. (which is just my opinion) i would contact kram if you think this is some sort of bug.