using trigger collider and animation to open door

im have a bit of a problem, i’m trying to open a door with collider and using a animation clip to open and close the door.
-heres the code i have so far-

function OnTriggerEnter (other: Collider){
animation. play(“dooropen”);
Debug. log (“you hit the collider”);
}

function OnTriggerClose (other: Collider){
animation. play(“doorclose”);
Debug. log (“you exit the collider”);

}

what am i missing… please help

yea i tried that but still not working…

That’s OnTriggerExit

Check which layers each collider is on, and check your physics layer settings
(Edit → Project Settings → Physics → Layer Collision Matrix.

Also be sure that during runtime: the collider’s game object is active, the collider component itself is enabled, and the script is enabled.

Also, only objects with a collider or a rigid body can trigger other colliders.