Sorry for the bad title but i have no idea how to title this.
So I am making this simulator type game test that has points, multipliers and cash with datastore.
So there is this tool that when you click it it gives you plus 1 points times the multiplier, to buy multipliers you click a gui, it will check to see if you have enough cash(which is 10) and if you do it will minus the amount of cash that you paid for and you will get plus 1 multiplier.
The problem is that i have this part for testing purposes that when you click it it gives you plus 1 cash but if you press it after you buy a multiplier it gives you plus 10 cash and then plus 1 like it is supposed to:
This is the cash giving script:
script.Parent.ClickDetector.MouseClick:Connect(function(player)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1
end)
This is the Multiplier scipt:
Multiplus.MouseButton1Click:Connect(function()
if player.leaderstats.Cash.Value >= 10 then
game.ReplicatedStorage.Multiplus:FireServer()
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 10 -- for some reason when i press plus 1 cash button it also adds this amount that I minus.
else
print("You're poor lol")
end
end)
I don’t know why when you click plus 1 cash it also adds the amount that i minus from the player