How do I disable enemy ai the script after enemy ai dies

I need to disable the script when the enemy ai die.Because what is going on is the enemy ai is follow the player after and before it dies .

Here is the enemy ai attack, idle , and move script :

using UnityEngine;
 using System.Collections;
 
  public class Enemyai : MonoBehaviour {
  public Transform player;
  static Animator anim;
      void Start () 
      {
              anim = GetComponent<Animator> ();
      }
      
      public void Stop(){
     anim.SetBool("isWalking", false);
     anim.SetBool("isAttack", false);
     anim.SetBool("isIdle", true);
     this.enabled = false;
     //Or if you want to destroy the AI script completely
     //Destroy(this)
 }

  
      void Update () 
      {

          
          if (Vector3.Distance(player.position, this.transform.position) < 20)
          {
              Vector3 direction = player.position - this.transform.position;
              direction.y = 0;
               Player.gameObject.activeSelf;
              this.transform.rotation = Quaternion.Slerp (this.transform.rotation,Quaternion.LookRotation(direction), 0.1f);
              
              anim.SetBool("isIdle",false);
              if(direction.magnitude > 2.6 )
              {
                  this.transform.Translate(0,0,0.09f);
                  anim.SetBool("isMoving",true);
                  anim.SetBool("isAttack",false);
                  }
              else
              {
                  anim.SetBool("isAttack",true);
                  anim.SetBool("isMoving",false);
                  
              }
          }
         else
         {
             anim.SetBool("isIdle",true);
             anim.SetBool("isMoving",false);
             anim.SetBool("isAttack",false);
             
         }
      
 }

      
 }

      
  
  Enemy ai has to deactivate first and then the die animation play on the health script :

 private void  DieLocal(Vector3 position, Vector3 force)
        {
            // Notify those interested.
            EventHandler.ExecuteEvent(m_GameObject, "OnDeath");
            EventHandler.ExecuteEvent<Vector3, Vector3>(m_GameObject, "OnDeathDetails", force, position);

            // Spawn any objects on death, such as an explosion if the object is an explosive barrell.
            for (int i = 0; i < m_SpawnedObjectsOnDeath.Length; ++i) {
                ObjectPool.Instantiate(m_SpawnedObjectsOnDeath*, transform.position, transform.rotation);*

}

// Destroy any objects on death. The objects will be placed back in the object pool if they were created within it otherwise the object will be destroyed.
for (int i = 0; i < m_DestroyedObjectsOnDeath.Length; ++i) {
if (ObjectPool.SpawnedWithPool(m_DestroyedObjectsOnDeath*)) {
ObjectPool.Destroy(m_DestroyedObjectsOnDeath);*

} else {
Object.Destroy(m_DestroyedObjectsOnDeath*);
_}
}*_

// Deactivate the object if requested.

if (m_DeactivateOnDeath) {
Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
GetComponent().Play();
anim.SetTrigger(“isDead”);

}

}

A easy way to disable the script is to run this after all the scripts of the enemy ai has ran

GetComponent<"Name of Script">().enabled = false;