Changing leaderboard stats

Hello, I’m currently trying to make a farming game. I’m trying to make a sell system with proximity prompts using leaderstats, it works fine, however changing the intValue to a higher number than the set one doesnt seem to do anything? It just reverts back to it’s original value after selling.

Leaderstats

local Players = game:GetService("Players")

local function leaderboardSetup(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Money = Instance.new("IntValue")
	Money.Name = "Money"
	Money.Value = 0
	Money.Parent = leaderstats
	
	local Wheat = Instance.new("IntValue")
	Wheat.Name = "Wheat"
	Wheat.Value = 5
	Wheat.Parent = leaderstats
end

Players.PlayerAdded:Connect(leaderboardSetup)

Script

local Prompt = script.Parent

Prompt.Triggered:Connect(function(Player)
		local Money = Player.leaderstats.Money
		local Wheat = Player.leaderstats.Wheat
	
		if Wheat.Value >= 1 then
			Money.Value += 1
			Wheat.Value -= 1
		end
		if Wheat.Value == 0 then
			print("no")
		end
end)

Any help is appreciated.

Are you adding currency on the client side?
That might be the issue

Wdym? Also for more context, changing the intValue works normally, however when the value gets subtracted it changes back to the original value. For example, changing the 5 ingame to something like 10 works fine, but subtracting it by 1 is 4. then 3 and so on.

Works fine outside of studio, no idea why this happens but that’s more important I guess