Hello! I have been creating a shop for the past few hours, but there's a problem: the money goes back up in a second after you purchase something. So, let's say there is something in the shop for 1 thousand cash, and you buy it and expect for your money to go down. Except the opposite happens. You have 5 thousand cash and you purchase the gear for 1 thousand. The money goes down to 4 thousand for a few seconds, then goes back to 5 thousand. I have a currency riser in the game, but it increases the value by 30 each 1 second. Heres the currency riser script:
while true do wait(1)
player.leaderstats[valueName].Value = player.leaderstats[valueName].Value + 30
end
And heres the shop script:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Parent.Clicked:Play()
if game:GetService("Players").LocalPlayer.leaderstats["Money"].Value <= 1001 then
game:GetService("Players").LocalPlayer.leaderstats["Money"].Value = game:GetService("Players").LocalPlayer.leaderstats["Money"].Value - 1000
local balloon = game.Lighting.RedBalloon:Clone()
balloon.Parent = game.Players.LocalPlayer.Backpack
end
end)
All help will be appreciated! :)

5 comments
Im using a server script...
It’s definitely in a local script cause you wouldn’t be able to get the LocalPlayer the way you did in a script.
You cant use localplayer in a server script nor gui functions im pretty sure
that still doesnt make it NOT GO BACK UP though lol
It is why. To reference the player in a LocalScript, you would use LocalPlayer. In a server script, there are multiple ways. However, for your shop script since it's on the Client, it is not able to change your leaderstats. That's something the server is supposed to do because leaderstats are for everyone to see.