I add 100 and then subtract 100 and I get -0. How to not get a negative zero

the player gets to sell and buy things, and the total is calculated. when he is done and he has nothing left he should be at 0. but sometimes it shows -0.

try using “is nearly equal” to check if its close to 0 and set to 0 maybe.

It’s because you are using a float. You should round to a decimal place and clamp to 0.0 or use int if you can make it work with whole numbers.

3 Likes