Play animation when shot

I have a animation for my zombie to play when it gets shot, the animation makes the zombie get knocked back a little. But i want the animation to play when ever i shot the zombie with my ray cast. Can anyone help me with my script to make this possible.

Heres my script

var target : Transform; //the enemy's target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning

var myTransform : Transform; //current transform data of this enemy
var isNotDead : boolean = true;
var health : float = 100;
function Awake()
{
    myTransform = transform; //cache transform data for easy access/preformance
}

function Start()
{
     target = GameObject.FindWithTag("Player").transform; //target the player

}

function Update () {
	
	if(health < 1){
	
		isNotDead = false;
		animation.Play("fallToFace");
		Destroy(gameObject, 1);
	}
	
	if(isNotDead){
	
	    //rotate to look at the player
	    myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
	    Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
	
	
	    
	    var distance = Vector3.Distance(target.position, myTransform.position);
	    if (distance < 3.0f) {
	        animation.Play("attack1");
	    }
	    else{   
	    	//move towards the player
	   		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
	   		animation.Play("shamble");
	    }

	}
}

function ApplyDamage(dmg : float){

	health -= dmg;

}

On the player, you could do something like this (All Code Untested):

      if (attacking)
        {
             var hit : RaycastHit;
             var fwd = transform.TransformDirection (Vector3.forward);
        
                if (Physics.Raycast (transform.position, fwd, hit, 100.0)) 
                {
                   if (hit.GetComponent(EnemyScript))
                    hit.GetComponent(EnemyScript).gettingHit = true;
                }
        
        }

Then on the enemy, you could do something like this in the update:

if (gettingHit)
{
   animation.play(hitAnimation);
   yield WaitForSeconds(1f);
   gettingHit = false;
}