Detach weapon from arm when needed in animating?

I have a weapon that’s attached to the rig’s arm, and while this is sufficient for most things sometimes I want the weapon to move freely instead of being attached. Welding it to the rootpart solves this but then I’ll lose out on the attached to right arm behaviour which is what I need for most cases. Any ideas?

Cant u motor4d to animate the gun?