Help me .... Ammo Pick Up !!!

Hi guys, When I pick up the ammo on the table they are destroyed but the variable amount is not added to the variable that determines the ammunition clips that I have. HELP ME

var obj1 : Transform; //the gameobject (Ammo)

var obj2 : Transform; //my Player

var Bar : float; 

var amount = 60; //number of clips what I will add to the var clips

  
function Start () 

{	
    var Bar = (Screen.width / 1);
}


function Update()
 
{
    var dist = Vector3.Distance( obj1.transform.position,obj2.transform.position );
    											//if distance is < 4
    if(dist < 4)
    {
    
           if(Input.GetKeyDown ("f")) //if I press f
       
            {
                AddClip();                	  //Go to function AddClip
            }

    }
    
}

           
function OnGUI() //function for Gui		

{   

    var dist = Vector3.Distance( obj1.transform.position,obj2.transform.position );
    
    if(dist < 4)

    {      
        GUI.Box (new Rect(10, 740, Bar, 40), "Ammo for M4A1, F to pickup");
            
    }       
   
}

function AddClip ()
{	
	
	var ammo : gunscript = GetComponent(gunscript);		//
	if (ammo)						// Add Clip to to the var clips in the script "gunscript"
        ammo.clips += amount;					//
	
	WaitForSeconds(1);
	
	DestroyClip(); //after addedclip destroy the gameobject ammo
	
}

function DestroyClip()
{
	Destroy(gameObject); 
}

//and this is the variable clips in the script "gunscript"

//var clips : int = 20;

//the variable clips are the clips in the M4A1 for reloading

I would rather do this if I were you but hey, we’re different.

//script on player

var ammoAmount : int; //ammo amount or ammo count that we have.
private var ammoBox : Transform; //the ammo box object
private var pickUp : boolean; //the boolean/switch

fucntion Update () {
if(pickUp  Input.GetKeyDown("f")){ //if there is an ammobox and we can pick it up and we press 'f'...
Restock(); //...we restock
}
}

function Restock () {
var access = ammoBox.GetComponent("Ammo Script"); //get script from ammoBox
ammoCount+=access.ammo; //add ammo from box
Destroy(ammoBox); //destroy box
pickUp = false; //this may not be nessecary
}

function OnGUI () { //On GUI is faster than Update so doing Vector3.Distance in both Update and OnGUI and is unnessecary and can reduce performance and triggers are a good alternative for this
//or you could have a boolean and Vector3.Distance in the Update function and if the dist is < 4 the boolan is true and sets the GUI on
if(pickUp){ //if we can pick it up...
GUILayout.Label(" > Press 'f' to Pick Up Ammo"); //..display his message
}
}

function OnTriggerEnter (tri : Collider) { //If something hits our trigger...
if(tri.gameObject.tag == "Ammo"){ //and it is tagged Ammo...
ammoBox = tri.gameObject.transform; //ammoBox is that object...
pickUp = true; //and we can pick it up
}
}

and have this on a box of ammo:

//on a box of ammo

var ammo : int;

I get this error Unknown identifier: ‘ammoCount’.
Perphas you meant this ammoAmount ??

The function OnTriggerEnter don’t work (my player don’t have a rigid body, but i have try with the component rigidbody)

//am not experienced in javascript but i will give you idea for solving the bug

var obj1 : Transform; //the gameobject (Ammo)

var obj2 : Transform; //my Player

var Bar : float;

var amount = 60; //number of clips what I will add to the var clips

var bpickup=false; //initialise a boolean variable as false

function Start ()

{
var Bar = (Screen.width / 1);
}

function Update()

{
var dist = Vector3.Distance( obj1.transform.position,obj2.transform.position );
//if distance is < 4
if(dist < 4)
{

if(Input.GetKeyDown (“f”)) //if I press f

{
bpickup=true; //when the user press f make it to true
AddClip(); //Go to function AddClip
}

}

}

function OnGUI() //function for Gui

{

var dist = Vector3.Distance( obj1.transform.position,obj2.transform.position );

if(dist < 4)

{
GUI.Box (new Rect(10, 740, Bar, 40), “Ammo for M4A1, F to pickup”);

}

}

//change the condition in the AddClip ()
function AddClip ()
{

var ammo : gunscript = GetComponent(gunscript); //
if (bpickup ammo.clips<=50) //50 is the maximum no of ammo that can be loaded you can give your own value
ammo.clips += amount; //

WaitForSeconds(1);

DestroyClip(); //after addedclip destroy the gameobject ammo

}

function DestroyClip()
{
Destroy(gameObject);
}

//and this is the variable clips in the script “gunscript”

//var clips : int = 20;

//the variable clips are the clips in the M4A1 for reloading