Setting up health script. will not work,

I wanted to test a health script by placing it in a cube, the script will set Health to 100, and if the get hit by a bullet, they lose 50 of their health, and when they go to 0 health, they are destroyed, to test it, I placed it on a game object. set Trigger to true, and gave Bullet a tag, but it still won’t destroy. did I make an error? It’s a fairly simple script.

#pragma strict

var Health : int = 100;
var Bullet : GameObject;

function onBulletHit( hit : Collision ) {
	if(hit.gameObject.tag == "Bullet"){
	MaxHealth =- 50;
	}
}
function onDeath() {
	if(MaxHealth < 0)
	Destroy(gameObject);
	}

What save just said is right , you need some way of calling thoses

you’d probably want to change them to Update & OnTriggerEnter (since you’re making the collider isTrigger)
`

function OnTriggerEnter( hit : Collider ) {
if(hit.gameObject.tag == "Bullet"){
MaxHealth =- 50;
}
}
function Update() {
if(MaxHealth < 0)
Destroy(gameObject);
}`