Damage script is screwed up...? what to do?

Enemy script

var damage = 10;

function OnCollisionEnter (col : Collision) {

col.gameObject.BroadCastMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);

Player Script

var health = 50;

function ApplyDamage (damage : int) {
     health -= damage;

     if(health <= 0) {
function Die () {
   Application.LoadLevel (Application.loadedLevel); 

I used these both scripts, one on the cube and one on my player. But when the cube collides with my player, nothing special happens, it just walks past my player like nothing happened. What should i do? Does the problem lie on.... that's the problem... i don't know what should be taken care off.

PLZ help cause i'm.... lost and noob..


Before you worry about the Messaging , you need to verify that the collision is happening.

-Does your Cube have a rigidbody attached to it?

-You need to know what are you colliding with.

--create a tag and add the tag to the Cube (I am using enemy in the example below) I added this to the player:

function OnCollisionEnter (col : Collision) {


Debug.Log("Collision Happened");



If collision Happens then you need to deal with the rest