picking up objects

i need help picking up objects in unity. i have found a pick up script but i dont know were to attach it to. here is the script:

private var isHighlighted : boolean = false; 
private var gameCharacter : Transform; 
private var distance : float; 

function Start() { 
   gameCharacter = GameObject.Find("First Person Controller").GetComponent(Transform); 

function OnMouseEnter() { 
   if(distance <= 4.0) { 

      renderer.material.color = Color.red; 

      isHighlighted = true; 

function OnMouseExit() { 
   renderer.material.color = Color.white; 


   isHighlighted = false; 

function Update () { 
   distance = Mathf.Sqrt((gameCharacter.position - transform.position).sqrMagnitude); 

   if(Input.GetKey("e") && isHighlighted == true){ 

function CreateInfoName(){ 
   var infoName = new GameObject("infoName"); 
   infoName.GetComponent(GUIText).text = gameObject.name; 
   infoName.transform.position = Vector3(0.5, 0.5, 0); 
   infoName.GetComponent(GUIText).alignment = TextAlignment.Center; 
   infoName.GetComponent(GUIText).anchor = TextAnchor.LowerCenter; 
   infoName.GetComponent(GUIText).pixelOffset = Vector2 (0, 25); 

can anyone help me figure this out please

The script you posted doesn't seem to deal with "picking up" as such. Rather, it seems to allow the user to hover their mouse over nearby objects and have the gameObject name be displayed when hovering.

You would place this script on each "hoverable" object.

If you wanted to add some functionality to pick up the object when clicked, you might add something like this:

function OnMouseDown() { 
   if(distance <= 4.0) { 
      // (whatever should happen when object is collected here!)

What happens in your game when an object collected is entirely down to your own game design. Does it add some energy to your player? is it added to an inventory? is the pickup GameObject destroyed, or is it parented to the player as a visible attachment?