Player takes damage on collision with an enemy

So i’m working a game where zombies(cubes) follow the player around and do damage when they collide with the player. I can get the enemies to follow the player just fine but i can’t manage a code to damage and destroy the zombies(tried with raycast) or that will cause damage to the player when the zombies collide with it. Maybe tags with an OnCollisionEnter might work. Not really sure. I’d really appreciate some help.

I found this and it’s exactly what I’m going for :

Make a public static variable of your health…


Attach this script to your zombies and use this health as your player’s health

public static float health = 100;
void OnCollisionEnter(Collision col){
if( == "Player"){