Explosion damage problem

I have the script:

var explosionRadius = 20.0;
var explosionDamage = 1;
var explosionTimeout = 5.0;

function Awake(){
	var explosionPosition = transform.position;
	
	var colliders : Collider[] = Physics.OverlapSphere (explosionPosition, explosionRadius);
	for (var hit in colliders) {
		var closestPoint = hit.ClosestPointOnBounds(explosionPosition);
		var distance = Vector3.Distance(closestPoint, explosionPosition);

		var hitPoints = 1.0 - Mathf.Clamp01(distance / explosionRadius);
		hitPoints *= explosionDamage;

		hit.SendMessage("ApplyDamage", hitPoints, SendMessageOptions.DontRequireReceiver);
	}
	
	Destroy (gameObject, explosionTimeout);
}

and it is not working correctly. It is supposed to be causing damage to the enemy, with the health script:

var health = 1.0;
var hitsound : AudioClip;

function OnCollisionEnter (hit : Collision) {
	if (hit.gameObject.tag == "cube") {
		SendMessage("ApplyDamage", .5);
	}
}

function ApplyDamage (damage : float) {
	health -= damage;
	
	SendMessage("CheckHealth");
}

function CheckHealth () {
	if (health == 0) {
		Destroy (gameObject);
		
		if (hitsound)
			AudioSource.PlayClipAtPoint(hitsound, transform.position);	
	}
}

but it is not working.

Try accessing the gameObject of the hit before you send the message:

hit.gameObject.SendMessage(“ApplyDamage”, hitPoints, SendMessageOptions.DontRequireReceiver);

It still doesn’t work