Have a DataStore bug

Data store doesn’t save value when I give to myself currency by game.Players.TheCookieDragonPlays.leaderstats.hiddenfolder.Coins.Value += 0 and when I rejoin the value stays at the same number as it was earlier.
Code:

local DataStoreService = game:GetService('DataStoreService')

local SaveValue = DataStoreService:GetDataStore('SaveValue')

function SaveData(player)
	local success, errormessage = pcall(function()
		SaveValue:SetAsync(player.UserId .. "-coins", player.leaderstats.hiddenfolder.Coins.Value)
	end)
	if success then
		print("Player Data Saved")
	else
		print("Player data not saved")
		warn(errormessage)
	end
end

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local hiddenvalue = Instance.new("Folder")
	hiddenvalue.Name = "hiddenfolder"
	hiddenvalue.Parent = leaderstats

	local cash = Instance.new("IntValue")
	cash.Name = "Coins"
	cash.Parent = hiddenvalue

	local data
	local success, errormessage = pcall(function()
		data = SaveValue:GetAsync(player.UserId .. "-coins")
	end)

	if success then
		cash.Value = data or 0 -- Default to 0 if data is nil
	else
		print("There was an error whilst getting your data")
		warn(errormessage)
	end

	game.Players.PlayerRemoving:Connect(SaveData)
end)

game:BindToClose(function()
	for _,player in pairs(game:GetService("Players"):GetPlayers()) do
		SaveData(player)
	end
end)

Your game.Players.PlayerRemoving function seems to be inside the PlayerAdded function, try removing it out of the function

It isnot working unfortunately.

Have you published the current place?

Yes, I have published the place…

No Like the script changes, not that the Place is public

Fixed. I don’t know how but sometimes it is not uploading correctly.

If I use the command and but coins then it came back to earlier and add me these coins from buying.

I don’t know why it is happening.