You may still need to attach the script to your gun in the editor.
But even if that works you need to fix the positions you have listed. They are absolute positions, in world space. You will want positions relative to the player’s location, otherwise your gun will stay stuck in the center of the map.
A simple way to do this is to make empty gameobjects at each of those coordinates then drag them onto the player object, so they will move around with him. Then, make public references to their transforms in your script and move the gun’s position from one transform to the other instead of positionA to positionB.