Detaching and reposition objects

I want the player to be able to drop the gun and pick up a new one but I can seem to reposition the gun. The current gun is a child of the player and its position is set relative to the player but when I use

transform.parent = null;

it sets the position of the gun in world space and I can change the position by creating a new vector fr the position.

Seems odd.
I would assign a parent, not just null for the dropped gun, and set a position for that gun.