Problems with Data loss

I’ve recently been having reports of data not saving in my game, and that is affecting my players views on my game, id say it happens about 10% of the time but i have little info since no warnings or errors seem to be showing up on the error report
Does anyone know why this is happening?

-- Load data

Players.PlayerAdded:Connect(function(Player)
	
	local Leaderstats = Instance.new("Folder")
	Leaderstats.Parent = Player
	Leaderstats.Name = "leaderstats"
	
	local Levels = Instance.new("NumberValue")
	Levels.Name = "Level"
	
	local Height = Instance.new("NumberValue")
	Height.Name = "Altitude"
	
	local PosValue = Instance.new("CFrameValue")
	PosValue.Name = "PosValue"
	
	local CurrentSetting = Instance.new("StringValue")
	CurrentSetting.Name = "CurrentSetting"
	
	local OtherStats = Instance.new("Folder")
	OtherStats.Name = "Collectibles"
	
	Levels.Parent = Leaderstats
	Height.Parent = Leaderstats
	PosValue.Parent = Player
	CurrentSetting.Parent = Player
	OtherStats.Parent = Player
	
	local success, CurrentStats = xpcall(ProgressStore.GetAsync, warn, ProgressStore, Player.UserId)
	
	if success then
		
		if CurrentStats then
			
			if CurrentStats["Position"] == nil then
				CurrentStats["Position"] = {CFrame.new(-12, 29, 629):GetComponents()}
			end
			
			if #CurrentStats["Position"] == 4 or CurrentStats["Ambience"] == nil then
				CurrentStats["Position"][4] = nil
				
				CurrentStats["Ambience"] = "Lobby"
			end
			
			Levels.Value = CurrentStats["Level"]
			CurrentSetting.Value = CurrentStats["Ambience"]
			PosValue.Value = CFrame.new(unpack(CurrentStats["Position"]))

			for i, v in ipairs(CurrentStats["Collectibles"]) do
				local NewValue = Instance.new("BoolValue")
				NewValue.Name = v
				NewValue.Parent = OtherStats
			end
			
		else
			
			Levels.Value = 1
			PosValue.Value = CFrame.new(-12, 29, 629)
			CurrentSetting.Value = "Cave"
			
		end
	else
		warn("Data will not be saved")

		local DontSave = Instance.new("BoolValue")
		DontSave.Parent = Player
		DontSave.Name = "DontSave"

		game.ReplicatedStorage.Remotes.DataFail:FireClient(Player)
	end
	
	Levels.Changed:Connect(function()
		print("Saved")
		SaveStats(Player)
	end)
end)

-- Save data
function SaveStats(player)
	
	if player:FindFirstChild("DontSave") then warn("Data not saved") return end
	
	local CollectiblesTable = {}
	for i, v in ipairs(player.Collectibles:GetChildren()) do
		table.insert(CollectiblesTable, v.Name)
	end
	
	local Pos = { player.PosValue.Value:GetComponents() } 
	
	local StatsTable = {
		["Level"] = player.leaderstats.Level.Value,
		["Collectibles"] = CollectiblesTable,
		["Position"] = Pos,
		["Ambience"]  = player.CurrentSetting.Value
	}
	
	local waittime = 2
	local MaxTries = 5
	local success, err
	local err


		repeat
			MaxTries -= 1

			success, err = pcall(function()
				ProgressStore:UpdateAsync(player.UserId, function(PastData)
					return StatsTable
					
				end)
			end)
			
			if not success then
				warn(err)
				task.wait(waittime)
				waittime *= 2
			end

		until success == true or MaxTries == 0

		if not success then warn("Data not saved of".. player.Name) end
end

Players.PlayerRemoving:Connect(SaveStats)

if RunService:IsStudio() then
	game:BindToClose(function()
		task.wait(1)
	end)
end

I have tried many solutions alredy and really couldnt really land on anything that works perfectly

Your savestats function is below the function call so it can’t run? Am I going haywire again

Its not a local function so it can still be called from above, also the save function is connected to player removing too