I am trying to make my character animate on touch or Click

I am trying to make my character animate on touch or Click. Is this possible with this code??? I am attaching this script to the Character.

#pragma strict

var targethit : GameObject;


function Update()
{
checkForHit();

}

function checkForHit()



{

    var ray = Camera.current.ScreenPointToRay (Input.mousePosition);

    var hit : RaycastHit;       
    
            

    if (Physics.Raycast (ray, hit, 200)) 

        {

            var objecthit:Transform = hit.transform as Transform;

                

            if (hit.collider.name == targethit)

            {

                animation.Play("hurt-front");

            }

        }           

}

What is happening when you are trying this code ?

nothing at all.

There was an error. I fixed. Still nothing happening, here is the current code.

#pragma strict

var targethit : GameObject;


function Update()
{
checkForHit();

}

function checkForHit()



{

    var ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    var hit : RaycastHit;       
	
            

    if (Physics.Raycast (ray, hit, 200)) 

        {

            var objecthit:Transform = hit.transform as Transform;

                

            if (hit.collider.name == targethit)

            {

                animation.Play("hurt-front");
                Debug.Log("FClicked on guy!");

            }

        }           

}