Why does my hurting script doenst works?

Im having a “Lava” Cube, and attached a Hurt script to that, so that the player will get hurt.
My Character Controller have a Rigidbody.

So thats the Script:

#pragma strict

public var health : float = 100.0;
public var damage : float = 20.0;


function Start () {

}

function Update () {

}

function OnTriggerStay (otherObj : Collider) {
    if (otherObj.tag == "Player"){

DeductHealth();
}

if ( health <= 0.0 )
{
Application.LoadLevel("gameover");
}

}

function DeductHealth () {
Debug.Log("Deducting Health!");
health -= damage * Time.deltaTime;
}

function OnGUI()
{
    GUI.Box( Rect( (Screen.width * 0.5) - 60, Screen.height - 35, 120, 25 ), "Health : " + parseInt( health ).ToString() );
}

But if im going on the Lava, nothing happens?

You’ve got ‘OnTriggerStay’, but I’m guessing your collider isn’t a trigger.

did you attach this to player or the lava?

If player, it shouldent detect for player.

If on lava, why does lava need health?

im not sure about that deduction work whit -=

Good question. It does make it look like this script was written for the player lol.