Making kermite weapons for npcs

I’ve just recently tried to make rebel npcs use a few of kermites smgs. I see the npc trying to use the weapon, I hear the weapon fire, no bullets burst from the weapon and it gives an error in the middle of them firing. The error is “weapons/kermite_base/shared.lua:486: attempt to call a nil value”. Would there be a way of fixing this so that the npcs can fire correctly?