I was making the sword shop. Then when I spammed the button. I went into the negative coins. I set up a conditional but it seemed to work.
if game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value >= 2000 then --do stuff end
I am on mobile so this was from Memory. The coin subtraction is fine. Going into negatives isn't.
I can't tell if this is the issue with only one line, but maybe you should try adding a debounce so they can't spam the button. There's probably some other issue, but I can't fix it with just that.
pressed = false if game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value >= 2000 and not pressed then -- Do stuff. wait(1) pressed = true end
Are you using a NumberValue? Sometimes if you keep adding to a number value it will just hit a certain point and go negative. I'd suggest using an IntValue ;o;