Help with dammage script

Hi I am quite new to Unity and i have been following a few video tutorials to help me learn. I have created a basic level and have two sentry guns which work and fire and cause damage to my first person controller (all good so far)

The problem I have is causing damage and destroying my sentry guns, I have use the same type of scripts like the player health, but something strange happens, both the sentry guns explode as soon as I shoot regardless of the damage or if the bullets hit.

Can anyone post a simple script one for my projectile to cause damage and one for the sentry gun to receive it I would be grateful.

You can try this:

to apply damage to an object you can do the following:

when your bullet collides with the object that will receive the damage do this:

apply this script to your bullet.

void OnCollisionEnter(Collision col)
{
    col.gameObject.SendMessage ("ApplyDamage", 5.0, SendMessageOptions.DontRequireReceiver);
}

gameObject must be the gameObject that will receive the damage(you can assign it or use the parameter received with your colliding function)…

then on the damage receiver object create this function:

void ApplyDamage (Float damage) {
    currentHeal -= damage;
    print (damage);
}

this will remove X hitPoints from your current health.

Sorry was at work at the time, my dammage script is as follows

var rayCastLength = 5;

function Update ()
{
var hit : RaycastHit;

if (Physics.Raycast (transform.position, transform.forward, hit, rayCastLength))
{
if(hit.collider.gameObject.tag == “Mini”);

Healthminigun.GUNHEALTH -=50;
Destroy (gameObject,.2);
}

}

sorry i guess it would help if i posted my script, below is what i have on my projectile

var rayCastLength = 5;

function Update ()
{
var hit : RaycastHit;

if (Physics.Raycast (transform.position, transform.forward, hit, rayCastLength))
{
if(hit.collider.gameObject.tag == “Mini”);

Healthminigun.GUNHEALTH -=50;
Destroy (gameObject,.2);
}

}

and this is what is on my sentri gun

var explosion : GameObject;
static var GUNHEALTH = 100;

function Update () {

if(GUNHEALTH <=0)
{
var explosionClone = Instantiate(explosion,transform.position, transform.rotation);
explosionClone.GetComponent(“Detonator”);
Destroy (gameObject,.6);
Destroy (rigidbody);
}

}

i am copying snipts of code trying to understand what each does so any help please

thanks