I made my code so that if i hit an enemy its health will go down but when i hit the enemy the health doesnt go down. please help

#pragma strict

var Health = 100;

function ApplyDammage (TheDammage : int)
{
    Health -= TheDammage;
}

You can actually set the maxdistance as 3rd physics.raycast argument, instead of hit itself, so you wont need those two distance variables.

    if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), 1.5))

And 1.5 is a very small number, you have to be very close for it to work, try setting it to 5 or something. If that didnt work add debug message after fire1 button press and after physics and see which and which doesnt.