It’s important to understand what this line does. It says if the transform of the object the script is running on happens to equal whatever object you’ve dragged into the script via the inspector, it will be true.
Since you’ve presumably put this script on your player character (and not a zombie) it means it’ll always return false because your player character isn’t a zombie. Either way, at no point does it test anything against the object you’ve collided with.
Try this instead :
var zombie : Transform;
function OnCollisionEnter(collision : Collision) {
if(collision.transform == zombie)
{
hud.hp = hud.hp - 1;
}
}
Are you making the game object that is suppose to take health a trigger? and if so do you have a collider on your character so that it knows it hit the trigger?