How do I make an animation play once on TriggerEnter?

I am trying to make a door animate whenever the user enters the trigger. However, I can’t seem to make it play only once. I’ve tried setting the animation to Clamp Forever, but that makes it play once and never play again. I have tried other answers that seemed relevant to the problem I am having and nothing seems to work. I would like the animation to play every time the user enters the trigger. Here is my code:

var object : Animation;
var played = false;
var trig = false;

function Start () {
    played = false;
    trig = false;
}

function OnTriggerEnter (other : Collider) {
    trig = true;
}

function Update ( ) {
    if(trig == true) {
        object = GetComponent.<Animation>();
        object.Play("Door002Open");
}

“Door002Open” is the name of my animation. I appreciate any help on this. Thank you.

Also you need to fix your code, because your trig variable is never set to false once it’s set true.