Global variable of ammo

I want to make an ammunition variable. How do I make that, when it get’s to zero, you can’t shoot again (stop from substracting)?
Edit: I mean, I want to prevent this:
this

In the event that fires the bullet and decreases the ammunition variable, add a condition to check that the ammunition variable is greater than 0.

1 Like

It works, but it stops in -1

Sounds like the condition to check isn’t correct or there is something outside the condition changing the variable.

Are you able to share a screenshot of the section in question?

Here:

Why are you subtracting 2?

To get to -1 in steps of two would suggest either you are starting off with an odd ammunition value, or you are reducing by 1 somewhere else.

1 Like

To add on to what the big old MrMen said. If you want to subtract 2 AND you’re at an odd amount of ammo, you will need to change > 0 to something like equal or greater then 2.

That way if you’re at 2+ ammo you can shoot, but if you’re only at 1 you can’t (which means you don’t get -1)

I’ve alredy found how it had to work:


Also, they were to, so that’s why it did’nt worked:

thanks.