I made this script attached to the shotgun on scene so it would move it in the hierarchy to be a child of player and reset to position to 0,0,0 but the position is random every time. If I run the script to reset position without changing the parent the position will change to 0,0,0:
public void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
transform.position = new Vector3(0.0f, 0.0f, 0.0f);
transform.SetParent(weaponPosition);
transform.position = new Vector3(0.0f, 0.0f, 0.0f);
}
}