The OnTriggerEnter() function is not working.

Hello, I’ve been at Unity for quite a while now and for some random reason the OnTriggerEnter() function is not working properly. What I’m trying to do is create an animation for when the door opens. I have my parameters and everything correct, but the code isn’t working. I’ve visited many websites but none of any of those other solutions help. I need help please.

using UnityEngine;

public class OpenDoorsWithE : MonoBehaviour
{
Animator animator;

// Start is called before the first frame update
void Start()
{
    animator = GetComponent<Animator>();
}

// Update is called once per frame
void Update()
{
    
}

void OnTriggerEnter(Collider col) {
    if(col.CompareTag("Player")) {
        if(Input.GetKeyDown(KeyCode.E)) {
            GetComponent<Animator>().SetTrigger("OpenDoor");
        }
    }
}

}

It worked! All I simply had to do is create a bool in the OnTriggerEnter() function, then call that bool in the Update() function and add my code in there.