If statment to check if player is within collider

I am creating a door that opens when the player enters the Collider box.

But how can i check to see if the player has left the collider box. So the door dosent close while the player is standing in the doorway, but automaticly closes when the player has moved away from the door.

I also need to make shure that if the player re-enters the collision box, while the door-close animation is playing. Then the door finishes the close animation but then immidetly plays the open animation.

Sounds like you're using the OnTriggerEnter function fine.

Now you just need to use the OnTriggerExit function to detect when the player leaves the collider.

If you really want to check whether the player is still currently within the collider, you could make use of the OnTriggerStay function, however from your description it sounds like the OnTriggerExit version is better suited.

In terms of the door completing its closing animation before re-opening, the implementation of that would be depending on what code you have already, however the general idea would probably involve having OnTriggerEnter and OnTriggerExit functions set a boolean flag, which allows the code to see whether the player is currently within the trigger area or not. Eg:

var playerInArea : boolean = false;

function OnTriggerEnter() {
    playerInArea = true;
}

function OnTriggerExit() {
    playerInArea = false;
}

You'd then just check whether the door should open based on both:

(playerInArea) and (door is completely closed)

hope this helps!