Making an animation start when my gun fires

Hi,Im trying to make my machine gun have sort of a recoil effect I have animated the gun but how do I only make play when i have shot the gun? Can anyone point me to a tutorial or tell me how

-thanks!

animation.Play(nameOfAnimationClip);

Well you got your script right, wellt under the FireOneShot function (if you have one)

example of the FireOnShot Code

function FireOneShot ()
{
    var direction = transform.TransformDirection(Vector3.forward);
    animation.Play("Fire Shot")
    var hit : Raycasthit;

    if(Physics.Raycast (transform.position, direction, hit, range))
    {
        if (hit.rigidbody)
           hit.rigidbody.AddForceAtPosition(force * direction hit.point);
        if(hitParticles)
        {
            hitParticles.transform.position = hit.point;
            hitParticles.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
            hitParticles.Emit();
        }

        hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReciever);
    }
}

This is the shoot function for my script. Pretty confusing huh.