I want to have a money system and I set everything else up to remove or add money but I don't know how to lock it so that it doesn't go below 0 can someone help me?
Can I have score not be below 0?
Feb 11 2020 01:58 PM
I'd like to refer you to my other answer to another post of yours: https://forums.coronalabs.com/topic/77147-can-i-have-a-collision-answer/#entry407089
That said, in this particular issue all you are looking for is a conditional check to see if the player has enough money to do whatever it is that they want to do.
local money = 50 local cost = 100 if money >= cost then print("you've got enough money!") -- then you could deduct whatever the cost was from the money, i.e. money = money - cost else print("you don't have enough money!") end
It really seems like you just need to start learning the basics. Happy coding!