@Kunit
I can't see what you're doing in that script. It looks like it'll echo 1 to 7 for the first 7 times you shoot the weapon, without firing a bullet, then on the 8th go it'll fire a bullet and reset the ammo to 0? Then it'll not fire anything for another 7 shots and so on... Seems like something went wrong there.
@OP
There's also the problem that all guns would use the same ammo, but I guess that's something to think about once you've got the basics down.
Perhaps an ammo mod might not be the best place to start for your first script? It's quite advanced.