Losing hp

Hi. I’ve got code:

 void OnTriggerEnter(Collider other){
     if(other.gameObject.CompareTag("zombie"))
         {
         currPlayerHealth = currPlayerHealth - 5;
         }
     }

And it doesn’t work. Same when I make

void OnTriggerEnter(Collider other){
	if(other.gameObject.CompareTag("bullet"))
		{
		currPlayerHealth = currPlayerHealth - 8;
		}
        }

I’m writing in C#.

Have you tried using OnCollisionEnter instead?

If you don’t want to use it, check the boxes labelled “Is Trigger” in the colliders.