Object reference not set to an instance of an object

I’m currently getting a problem with using instantiate to fire a projectile, it works fine in the editor but not once built as webplayer or standalone.

The error I’m getting in the output log is:

**NullReferenceException: Object reference not set to an instance of an object
at Elements.Update () [0x00000] in :0

(Filename: Line: -1)**

I have had a look at other examples with this happening but had no luck with implementing it into my code. Any help with sorting this out would be appreciated.

#pragma strict
    
    static var element : int = 1;
    
    
    var bulletfire : Rigidbody;
    var bulletice : Rigidbody;
    var power : float = 1500;
    var damage : float = 100;
    var bulletcount : int = 10000;
    var gunshot: AudioClip;
    var allowfire : int = 1;
    
    
    function Start () {
      bulletcount = bulletcount;  
    	
    
    }
    
      
    function checkgun () {  
      yield WaitForSeconds (0.5);
        allowfire = 1;
      }
    
    
    
    function Update () {
     	
     	
     	
     	
     	if (Input.GetKeyDown ("1")){
    			element = 1;
    	}
    	
    	if (Input.GetButton("Fire1")&& (allowfire == 1) && bulletcount && (element == 1)){
        
        allowfire = 0;
        audio.PlayOneShot(gunshot);
        var instance1: Rigidbody = Instantiate(bulletfire, transform.position, transform.rotation) as Rigidbody;
        var fwd1: Vector3 = transform.TransformDirection(Vector3.forward);
        instance1.AddForce(fwd1 * power); 
        bulletcount --;
        checkgun();
    	}
    	
    
    	if (Input.GetKeyDown ("2")){
    			element = 2;
    	}
    	
    }

Its not because the variable of bulletCount is being checked for true in the if statement block for the Input of Fire 1, yet its a Var not a boolean value. Wouldnt it have to be set like if( bulletCount == something) since its a Var? Or remove the variable of bulletCount from the If statement block altogether, cause it looks unnecessary to me or at least make it check whether or not bulletCount is > 0 to allow Shoot. With the code as it looks to me anyway, its check to see IF Fire 1 was pressed, and since bulletCount variable was set to 10000, then its basically like saying

if(Input.GetMouseButtonDOwn(0) &&(AllowFire = 1) && 10000 && (element=1)) 
{ 
then run this code 
}

That 10000 in there isn’t needed. Change that line of code to this:

if (Input.GetButton("Fire1")&& (allowfire == 1) && bulletcount > 0 && (element == 1)){