I have a script, where when a brick is touched you lose money. I would like to make it so that if you don't have over 25 money, you wont lose any. So its like buying something but if you don't have enough, you can't. Anyway, I don't know where to go from here, any help? (Sorry I struggled with the title)
moneyToGive = -25
debounce = false
script.Parent.Touched:connect(function(hit)
if debounce == true then return end
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player == nil then return end
stat = player:findFirstChild("leaderstats")
if stat == nil then return end
cash = stat:findFirstChild("Cash")
if cash == nil then return end
debounce = true
cash.Value = cash.Value + moneyToGive
wait(2)
debounce = false
end)

4 comments
All you did was coppy my script...
no i added a if cash.Value >= 25 then
So you did, I missed that, my apologies. Thank you!
Np