One significant enemy is getting killed if I jump over a random enemy from the same preferb

Okay Im new to unity. Ive made a script where I could jump over and kill an enemy. if I jump over it will take damage equal to 10 which is the maximum health of my enemies. than it will destroy itself after spawning ammo and effects. But every time I jump over a random enemy the last enemy that I had put from the preferb is getting killed.than I cant kill no one by jumping over but can kill by shooting. If I try to jump than i get stuck on top of them. need help.
here is the code I used in player to kill by jumping

      void OnCollisionEnter2D(Collision2D collision) {
    aipatrol enemy = collision.collider.GetComponent<aipatrol>(); 
    if (enemy != null){
        foreach (ContactPoint2D point in collision.contacts)
          //for the enemy to die  
          if(!healthscipt) continue ;
          Debug.DrawLine(point.point,point.point + point.normal,,10);
          if (point.normal.y >= 0.9f){
          //for the player to get hurt

//healthscipt is the script to reference enemy health. heres the script I used for enemy death

  public void Takedamage(float damage){
    hp -= damage;
    if(hp <= 0f ){

 void Die (){
    if(diepeffect != null){
   Instantiate (diepeffect,transform.position,Quaternion.identity);}
   float spawnrate = Random.Range(0,100f);
   if (spawnrate <= chancetospawnammo){

so I need help.

I’m getting the same problem, and i don’t know too

In the first script, where are you setting the value of healthscipt? I’m guessing you have set it to the healthscipt attached to one of your enemies, but in your code above you need to find the healthscipt attached to the enemy being collided with.