Trouble with java raycast scripts to open a door

please guys help… i do everything i saw in that tutorial video…but this script is not working…please guys help me!!!please!!!

here this code

      var rayCastLength = 5;

      function update() { var hit : RaycastHit;

      //Check if we're colliding
      if(Physics.Raycast (transform.position, transform.forward, hit, rayCastLength))
      {
      //... with the door
      if(hit.collider.gameObject.tag == "door")
      {
      //open the door!
       hit.collider.gameObject.animation.Play("door_open");
       }
        }

please guys help me to found this problem…tnx

also do you have the door tagged as door?
do you have an animation attached to the gameObject that your hitting with the raycast?

try this:
var rayCastLength = 5;

      function update() { var hit : RaycastHit;
 
      //Check if we're colliding
      if(Physics.Raycast (transform.position, transform.forward, hit, rayCastLength))
      {
      //... with the door
      if(hit.gameObject.tag == "door")
      {
      //open the door!
       hit.gameObject.animation.Play("door_open");
       }
        }