When making a game, you may want to limit the number of times a player can shoot a gun, use an item, or perform an action. This is just an integer value that is checked before each use and updated after.
The code/logic below can be added to a player script along with your regular shooting code to add an ammo count.
In my next article, we will be going over the creation of an ammo refill powerup!