When I kill one enemy, the rest disapear, but still shoot

So I have made my enemy a prefab and when I enter a invisible trigger box, it starts to spawn them. The only problem is that when I shoot one the rest disappear, but I can still shoot them even though they’re invisible now, and they’ll still shoot back. I’m also getting the following error 3 times as soon as I run the game: NullReferenceException: Object reference not set to an instance of an object. Any help on how to solve this problem would be most welcomed.

Here’s my code for spawning the enemies(Attached to the spawning area):

var Enemy: Transform;   var SpawnEnemies: int = 0;

var spawn = false;


function OnTriggerEnter(other: Collider){

	if(other.tag == "Player" && spawn == false)
	{
		InvokeRepeating ("Spawn",1,1);
		spawn = true;
	}

}

function Spawn(){

	var instantiatedenemy = Instantiate(Enemy,GameObject.Find("EnemySpawn").transform.position, transform.rotation); 
	SpawnEnemies +=1;
	
	if(SpawnEnemies >=10)
	{
		CancelInvoke("Spawn");
		spawn = false;
	}}

My code for when the enemy is destroyed is (attached to enemy):

if(life <= 0)
	{
		Destroy(gameObject);
	}

Code for when a bullet hits the enemy (attached to bullet):

   function OnTriggerEnter(enemy : Collider){
	if(enemy.tag == "Enemy")
	{
		Destroy(gameObject);
		EnemyScript.life -=1;
	}
}

EnemyScript.life is a static isn’t it? Got to be that - you need it to be a normal variable, otherwise they all share it.

 public var life : float;

Then in OnTriggerEnemy:

 if(enemy.tag == "Enemy") {
     Destroy(gameObject);
     enemy.GetComponent(EnemyScript).life -= 1;
}