Tool positions not working right with animations

I’m creating a gun for my game. In my game, I have a script that changes the Motor6Ds so that the arms and head look towards where the camera is looking (so if you look up, the head and arms look up as well).

I have a gun which raycasts and creates a visible bullet tracer from the end of the gun’s barrel to the raycast’s end position (which is going towards the mouse).

This works fine, except the script that changes the Motor6Ds conflicts with the gun script. When you fire, the raycast and the bullet tracer both appear where the end of the gun’s barrel would be if the Motor6D script wasn’t in effect, i.e. where the end of the barrel would be if you were facing perfectly straight.

So my question is, how can I get the position of a part after calculating Motor6Ds and animations?