Rigidbody taking damage.

I have this script but it is rubbish to me since it does not work with my rigid body cubes that will take damage.

private var dead = false;

static var gotHit = false;

function BoxColliderHit(hit:BoxCollider)
{
	if(hit.gameObject.tag=="fallout"){
	    dead = true;
	    Health.LIVES -=1;
	}
	if(hit.gameObject.tag == "enemyProjectile")
		gotHit=true;
}


function LateUpdate (){
		if(dead)
		{
                transform.position = Vector3(0,1.7,0);
		    dead = false;
		}
}

I does not work and i do not know why, is there an easier way to do this script, i need the script to get hit by a ball with the tag enemyprojectile and i want the rigidbody to take the hit and loose 1 life and then display it for me in the HUD( i have the HUD in another script).

HUD texture thing:

var health1 : Texture2D; //1 HP
var health2 : Texture2D; //2 HP
var health3 : Texture2D; //3 HP
var health4 : Texture2D; //4 HP
var health5 : Texture2D; //5 HP

static var LIVES = 5;


function Update () {

	switch(LIVES)
		{
			case 5:
			guiTexture.texture = health5 ;
			break;
			
			case 4:
			guiTexture.texture = health4 ;
			break;
			
			case 3:
			guiTexture.texture = health3 ; 
			break;
			
			case 2:
			guiTexture.texture = health2 ;
			break;
			
			case 1:
			guiTexture.texture = health1 ;
			break;
			case 0:
			//Death code here
			break;
		}
}

and here is the shooting and aiming script for my sentrygun thats is shooting.

var LookAtTarget:Transform;
var damp = 1;
var savedTime = 10;
var bullitPrefab:Transform;
function Update() {
    if(LookAtTarget){
	var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
	transform.rotation = Quaternion.Slerp(transform.rotation,rotate,Time.deltaTime * damp);

	var seconds : int = Time.time;
	var oddeven = (seconds % 2);
	if(oddeven){
		    Shoot(seconds);
		}
	}
}

function Shoot(seconds)
{

	if(seconds!=savedTime){
	    var bullit = Instantiate(bullitPrefab ,transform.Find("Spawn").transform.position,
	    Quaternion.identity);
	    bullit.rigidbody.AddForce(transform.forward*3000);
	    savedTime=seconds;
	}
}

In my case, i need the sentrygun to lock on the target, shoot the ball and then to make the ball cause damage to the rigidbody if it hits the rigidbody, and then make the rigidbody loose 1 part of its 5 parts. Is there any script for this? Iam very confuse and i dont cant come up with anything, please help! Ask if you need any info about script i h ave and all that. I can provide info if i can and if you need just ask me! Thanks!

You’re using a function called BoxColliderHit(), i’m not sure if that even exists, try using OnColliderEnter(collision : Collider) instead.