How to check collision with specific object

Hi, I’m having trouble with my health script for my EnemyAI script, the issue is basically that if my enemy collides with anything and a boolean of a player script called ‘IsAttacking’ is set to true, I can just attack until they’re dead without touching them. Can anyone give me a hint on how to fix this? Here’s my script:

var Health : float = 10000;
var Self : GameObject;
var PlayerScript : PlayerScript;

function OnTriggerStay () {
          if(PlayerScript.IsAttacking == true){
            Health -=5;
            if(Health == 0){
              Destroy (Self);

EDIT: Thought you were using a static due to your naming convention! (I must be slow this morning)

You need to get your PlayerScript from the object doing the hitting, so remove your PlayerScript variable and:

       function OnTriggerStay(other : collider)
            var player = other.GetComponent(PlayerScript);
            if(player && player.IsAttacking)