Making Instantiated Weapon a Child of the Player

I have a script that’s supposed to let the player walk over a gun on the ground and press e and it instantiates a clone of the gun and makes that clone a child of the player so it follows it around. Right now it instantiates the clon facing the right way and everything but it doesn’t become a child of the player. Any ideas? Thanks!

here’s the script:

using UnityEngine;
using System.Collections;


public class Player : MonoBehaviour {
	public bool equip;
	public Vector3 playerPosition;
	public Quaternion playerRotation;
	public GameObject Weapon;
	public GameObject equipedWeapon;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerStay(Collider other){
		Weapon = other.gameObject;
				
		if (other.gameObject.tag == "weapon"){
			if(Input.GetKeyUp("e")){
				playerPosition = transform.position;
				playerRotation = transform.rotation;
				equipedWeapon = Instantiate(Weapon,playerPosition,playerRotation) as GameObject;
				equipedWeapon.transform.parent = transform.parent;
				equip = true;
				other.gameObject.SendMessage("Equip", playerPosition);
				
			}
		}
		
	}


}

Try changing line 30:

equipedWeapon.transform.parent = transform.parent;

to:

equipedWeapon.transform.parent = transform;

It should works. Unless there is some code elsewhere, I guess the weapon has an animation on it’s highest (not higher, idiot !) gameobject which set the position somewhere else.