How to play an animation with a script ?

what do i say here to make it play an animation

var arm : Transform ; 

function Update () {
    if(Input.GetButton("Fire1")) {}  
}

Hi, first you add the Animation Component to the GameObject, to wich your script is attached. Then activate the loop checkbox on the animation component and use this script:

function Update(){

if(Input.GetButtonDown(“Fire1”)){

animation.Play(“example”);

}

if(Input.GetButtonUp(“Fire1”)){

animation.Stop(“example”);

}

}