Enemy wont damage player

Hey, im kinda a beginner so i dont understand complex stuff.
im trying to make a game where the enemy will damage the player when it walks inside of my box collider
The enemy has a box collider set to trigger
This is my scripts:

Enemy Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyAttack : MonoBehaviour {
    public bool inRange;
    public float damage;
	
	void Start ()
    {
		
	}
	
	
	void Update ()
    {
	  if(inRange == true)
        {
            //attack
            PlayerStats player = GetComponent<PlayerStats>();
             player.P_TakeDamage(damage);
            
               
            
        }
	}

    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            inRange = true;
        }
    }

     void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            inRange = false;
        }
    }

}

Player Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerStats : MonoBehaviour {
    public float currHealth;
    public float maxHealth;
	
	void Start ()
    {
		
	}


    public void P_TakeDamage(float ammount)
    {
        currHealth -= ammount;
    }



    void Update ()
    {
		if (currHealth > maxHealth)
        {
            currHealth = maxHealth;
        }

        if (currHealth <= 0)
        {
            //Die
            Die();
        }

    }
    public void Die()
    {
        Destroy(gameObject);
    }



}

Did you try debugging the code and watch values of inRange and currHealth ?

Do they both have a rigidbody component attached? If not make sure to add one to each otherwise IIRC the OnTriggerEnter and OnTriggerExit will never be called. Otherwise click on the enemy in the editors hierarchy and check wither the “inRange” variable is set to true when the player gets near.