Problem with DataStore

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)

did you go to server mode and change the player value?
because datastore cannot save any values changed by client

yes and i dont know why it doesn’t change

i found problem. you should put value inside leaderstats instead of the hidden folder. just remove the

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

and parent cash to “leaderstats” instead

also dont forget to change

SaveValue:SetAsync(player.UserId .. "-coins", player.leaderstats.hiddenfolder.Coins.Value)

To

SaveValue:SetAsync(player.UserId .. "-coins", player.leaderstats.Coins.Value)

Provided that they are accessing the same object in all scripts, the actual location of the object won’t matter. Given that its called ‘hiddenfolder’, I’d say its safe to assume that they deliberately have it in a folder so that it doesn’t appear on the player leaderboard. I doubt that making the change you suggested will fix the issue.