I should have looked first before asking because I remember now I'll go ahead and say what I did in case someone also needs a fix for this. Just go into cfg folder and open default.cfg, go to edit > replace, let's say the last number your gun was in MAME was gun 3 you want to replace anything that says CODE_1 or CODE_2 or CODE_4 with CODE_3 so you put in find what the code that the cfg says and in the replace box replace it with CODE_3.
But it'll probably change the gun number again so what you want to do after you've saved and closed the default.cfg is right click on it go to properties and click the box that says read-only and hit ok. This should prevent it from changing the numbers on you, I believe so anyway, hopefully.