Limiting ammunition is done with variables. For example, you could create a local variable attached to the player called Ammo. Every time the player presses the button to fire their gun, first you check if Ammo > 0, then if it is, create an instance of the bullet along with the firing animations (or whatever else is needed) and subtract 1 from Ammo.
If your code is right with your health bar, then it's probably something silly like a layer or object set to invisible. If you can't come right on your own then you should post a link to your capx
so we can take a look for you.