Killing the Enemy, Player Teammate Just Become Idle

AS am new to Scripting,I was actually useing this down Script As for EnemyAI and even for my Player Teammate but when i choose Specific Transform(enemy) (var Enemy: Transform;) to kill the gameObject That Work’s Fine, But when the Teammate Kill the enemy He Just Become Idle and even when the enemy kills the player too(I GET ERROR IN THE CONSOLE LIKE OBJ OF TYPE DESTROYED BUT YOU ARE STIL TRYING TO ACCESS IT) , I was actually Want him to kill other enemy when finished the specified one . I tried Whereas Times But i was Failed, Does Anyone have any Idea?

var MoveSpeed : float = 2;
        var Enemy: Transform;
        var MaxDist = 10;
        var MinDist = 5;
        var AnimObject : GameObject;
        var Health : float = 100;
        var DeadReplacement : GameObject;
        
        
        function Start () 
        {
        
        
        
        }
        
        function Update () 
        {
            transform.LookAt(Enemy);
            
          
            
            if(Vector3.Distance(transform.position,Enemy.position) >= MinDist){
                 transform.position += transform.forward*MoveSpeed*Time.deltaTime;
                 AnimObject.animation.CrossFade("RunAim");
            }
            else
            {
                  AnimObject.animation.CrossFade("StandingFire");
                  
                 if(Vector3.Distance(transform.position,Enemy.position) <= MaxDist)
                     {
                     gameObject.GetComponent(AIGun).Fire();
            } 
                   if(Health <= -500.05){
                        Destroy(gameObject);
                        Instantiate(DeadReplacement,AnimObject.transform.position,AnimObject.transform.rotation);
                        
                        }
               
            }
            
           
        
        }
        
        
        function AdjustHealth(Adj : float){
            Health -= Adj;
        }

The line:

transform.LookAt(Enemy);

is causing your problems. Enemy is dead, you can’t look at it anymore. Before accessing Enemy, check to make sure it’s still a valid object:

if( Enemy )
    transform.LookAt(Enemy);

same with your next if statement, you’ll need to check Enemy before accessing it.