sliding door problem

hi i m new with unity 3d i want to create my own game .but i have same issues with the sliding door i create an animation but it didn’t play when the player is close to the door please help

var rayCastLength = 10;
function Update()
{
  var hit : RaycastHit;
  if (Physics.Raycast(transform.psition, transform.forward, hit,rayCastLength ))
  {
  if(hit.collider.gameObject.tag == 'door')
  {
  hit.collider.gameObject.animation.Play('door_open');
  }
  
  }

}

Is this script attached to the Player gameObject?

Double check to make sure the tags are actually spelled “door” and “door_open”.