On collide animate

Hello everyone I have been wondering how to make a script where when the player collides with a box that is triggers and animation. Any scripts, tips, or tutorials provided would greatly be appreciated.
Sincerely Cobalt60

function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “Box”)
{
hit.gameObject.animation.Play(“Box_AnimationName”);
}
}

//JavaScript code