Problem:Insert a semicolon at the end.

i am making a fps game and i have a weapon script.The problem is that unity is telling me to insert a semicolon at te end ; line(50,15),but i have already put a semicolon there!

var sound : AudioClip;
var bulletSpeed = 100;
var projectile : Rigidbody;
var bullets = 30;
var totalBullets = 60;
var reloadTime = 3;

function Update () 
{ 
      Fire();
      Reload();
}

function Fire ()
{

 if(bullets > 0)
 {
    // Ctrl was pressed, launch a projectile
    if (Input.GetButtonDown("Fire1")) 
    {
        // Instantiate the projectile at the position and rotation of this transform
        var clone : Rigidbody;
        clone = Instantiate(projectile, transform.position, transform.rotation);

        // Give the cloned object an initial velocity along the current 
        // object's Z axis
           clone.velocity = transform.TransformDirection (Vector3.forward * bulletSpeed);
           AudioSource.PlayClipAtPoint(sound, transform.position, 1);
        //take a bullet of our clip if firing       
           bullets -=1;
           GameObject.Find("bullet_count").guiText.text = ""+totalBullets;
    }

  }

}

function Reload()
{ 
   if(Input.GetButtonDown("Reload"))   
   {
  yield WaitForSeconds (reloadTime) ;

    if(totalBullets > 0)
    {
       int transfer = 30 - bullets;

       if (transfer > totalBullets) 
       { 
          transfer = totalBullets; 
       }
       bullets += transfer;
       totalBullets -= transfer;

    }

    }
}

You have an extra '}' at the end of your code. Remove it and your script should work.

This problem often crops up when your nesting is broken, so whenever it says that and there is a semicolen on the end of your line, check your nesting and make sure it is correct.

Your indentation is all over the place. Also, you shouldn't use GameObject.Find, especially in an Update. Whether you use GameObject.Find or not, you should store a reference to the GameObject or Component at start so you won't have to Find it again and again.

Your problem is that you have mixed your syntax. For most of your code, you are using javascript, but at the line `int transfer = 30 - bullets;` you are incorrectly declaring the variable.

Here's a cleaner and corrected version:

var sound : AudioClip;
var bulletSpeed : float = 100.0f;
var projectile : Rigidbody;
var bullets : int = 30;
var bulletsPerClip : int = 30;
var totalBullets : int = 60;
var reloadTime : float = 3.0f;
private var bulletCounter : GuiText;

function Start() {
    bulletCounter = GameObject.FindWithTag("Counter").guiText;
}

function Update() { 
    Fire();
    Reload();
}

function Fire () {
    if(bullets > 0 && Input.GetButtonDown("Fire1"))  {
        // Instantiate the projectile at the position
        // and rotation of this transform
        var clone : Rigidbody = Instantiate(projectile, 
                                            transform.position,
                                            transform.rotation);

        // Give the cloned object an initial velocity along its Z axis
        clone.velocity = clone.forward * bulletSpeed;
        AudioSource.PlayClipAtPoint(sound, transform.position, 1);
        //take a bullet off our clip if firing
        bullets--;

        //You really shouldn't use GameObject.Find - it's slow
        //Tag your object and use GameObject.FindWithTag() in stead
        //Better still, since the object doesn't change store a reference to it
        //GameObject.Find("bullet_count").guiText.text = ""+totalBullets;
        bulletCounter.text = ""+totalBullets;
    }
}

function Reload() { 
    if(Input.GetButtonDown("Reload")) {
        yield WaitForSeconds(reloadTime);
        if(totalBullets > 0) {
            var transfer : int = bulletsPerClip - bullets;

            if(transfer > totalBullets) transfer = totalBullets; 

            bullets += transfer;
            totalBullets -= transfer;
        }
    }
}