Reloading Script

I am creating a projectile shooting script. I have no compile errors, but I encountered some problems after I added the reloading part. The gun will not fire anymore and I was wondering if some of you know what the problem is. Thank you in advance (btw Im using a seperate script on a bullet projectile that is spawned using this script).

var MaxAmmo =  1;
var Ammo = MaxAmmo;
var Bullets = 15;

private var timer = 0.0;
var reloadTime = 10.0;
 
var Fire : String = "MusketFire";
 
function Start () 
{
 
}
 
function Update () 
{
    if(Fire == "MusketFire")
    {
       if(Ammo > 0)
       {
         if(Input.GetMouseButtonDown(0))
         {
         FireOneBullet();
         }
       }
    }
 
 
    if(Input.GetKey("r"))
    {
       Reload();
   
    }
}
 
function FireOneBullet ()
{
    var Bullet = Instantiate(Bullet, FirePoint.transform.position, transform.rotation);
    Ammo --;
}
 
function Reload ()
 
{
    if(Ammo > MaxAmmo && Bullets > 0)
    { 
       if(timer<reloadTime)
       {
         timer+=Time.deltaTime;
       }
       else
         timer=0.0; 
 
    }
    if(timer>=reloadTime)
    	{
       		Ammo ++;
       		Bullets --;
    	} 
}

I think this is wrong:

function Reload (){
  // This won't happen since you have Ammo = MaxAmmo at the top
  if(Ammo > MaxAmmo && Bullets > 0) 
  {
    if(timer<reloadTime)
    {
        timer+=Time.deltaTime;
    }
    else
        timer=0.0;     
  }
  if(timer>=reloadTime)
  {
    Ammo ++;
    Bullets --;
  }
}

timer is not increasing since you would have to hold the button down.

I think you are willing to use coroutine as such:

function Reload (){
  if(Bullets > 0) // Not sure what you are checking here though
  {
    while(timer<reloadTime)
    {
        timer+=Time.deltaTime;
        yield;
    }
    timer=0.0;     
    Ammo ++;
    Bullets --;
  }
}

at line 45, your using a classic wrong arrow typo. when is Ammo ever more than Max Ammo?
your timer never starts, and never finishes, also you never reset your timer after the actual reloading, so the user has to press R twice the next time around.
the largest error is that your timer is called only one per frame so you need to hold down are for 10 seconds before reloading will work.

got it working though:

var MaxAmmo =  1;
var Ammo = MaxAmmo;
var Bullets = 15;

var Bullet : GameObject;
var FirePoint : GameObject;
 
private var timer = 0.0;
var reloadTime = 10.0;
 
var Fire : String = "MusketFire";
var reloading : boolean;
 
function Start () 
{
 
}
 
function Update () 
{
    if(Fire == "MusketFire")
    {
        if(Ammo > 0)
        {
            if(Input.GetMouseButtonDown(0))
            {
                FireOneBullet();
            }
        }
    }
 
 
    if(Input.GetKey("r"))
    {
        Reload();
 
    }
    if(reloading) {
        if(timer<reloadTime)
        {
            timer+=Time.deltaTime;
        }
        else
            timer=0.0; 
 
        if(timer>=reloadTime)
        {
            Ammo ++;
            Bullets --;
            timer=0.0;
            reloading = false;
        } 
    }
}
 
function FireOneBullet ()
{
    var Bullet = Instantiate(Bullet, FirePoint.transform.position, transform.rotation);
    Ammo --;
}
 
function Reload ()
 
{
    if(Ammo < MaxAmmo && Bullets > 0)
    { 
        reloading = true;
    }


    
}

though 10 seconds for a reload time is pretty excessive.
hope it helps