How do I allocate a parent to a gameobject that just got instantiated?

I’ve been working on a pickup system for a gun in my game and I want the gun to get instantiated if you press ‘e’ on it and become a child of my character controller. Here’s my script for the pickup and stuff

using UnityEngine;
using System.Collections;

public class GunPickup : MonoBehaviour 
{
	public bool gunPickup;
	public Font textFont;
	public bool guiShow = false;
	public GUIStyle guiFont;
	public GameObject gun;
	public GameObject realGun;
	public Transform hands;
	public Transform center;


	void Update ()
	{
		transform.Rotate(Time.deltaTime, 0, 0);
		transform.Rotate(0, Time.deltaTime, 0, Space.World);
		if(guiShow == true)
		{
			gunPickup = true;
		}
		else
		{
			gunPickup = false;
		}
		if(Input.GetKey(KeyCode.E))
		{
			Destroy (gun);
			Rigidbody assaultRifleReal;
			assaultRifleReal = Instantiate(realGun, hands.position, hands.rotation) as Rigidbody;
			
		}
	}
	void OnTriggerEnter(Collider coll)
	{
		if(coll.gameObject.tag == "Player")
		{
			guiShow = true;
		}
	}

	void OnTriggerExit (Collider coll)
	{
		if(coll.gameObject.tag == "Player")
		{
			guiShow = false;
		}
	}

	void OnGUI (){
		GUIStyle style = GUI.skin.GetStyle ("label");

		if (guiShow == true)
		{
			GUI.Label(new Rect(207f, 260f, 500f, 50f), "Press 'e' to pick up Assault Rifle", guiFont);
		}

	}
}

It Makes the ‘gun’ rotate on the floor as a pickup and when you walk onto the trigger, it displays a message at the centre of the screen telling you to press ‘e’, when you do, it instantiates the real gun in and it just floats there. I need help to get it to follow with the player’s movements. Sorry for adding the entire script, I’m new to the question asking thing so I don’t know what I’m supposed to put in.

You should attach gun as child to hands:

assaultRifleReal = Instantiate(realGun, hands.position, hands.rotation) as Rigidbody;
assaultRifleReal.transform.parent = hands;

Try add this code below Instantiate line:

assaultRifleReal.transform.parent = yourControllerTransform;