Whats wrong in my code or logic, please help!,Hi everyone, i have a problem with a door key situation:

I want to collect a key and when the player collects the key, the player should be able to open a door ontrigger enter.

here is my script

public class Key : MonoBehaviour
{

private void OnTriggerEnter(Collider other)
{
    if(other.tag == "Player")
    {
        Player player = other.GetComponent<Player>();
        player.CollectKey();
        player.OpenDoor();
        Destroy(this.gameObject);
    }
}

}

Player script:

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Lava")

        Destroy(this.gameObject);

    if (other.tag == "Door" && _canOpenDoor == true) 
    {

        Debug.Log("Hello");
        Destroy(other.gameObject);
    }

}

public void Shoot()
{
    if (Input.GetMouseButtonDown(0))
    {
        Instantiate(bulletPrefab, new Vector3(transform.position.x +1, transform.position.y, 0), Quaternion.identity);
        
    }
}

public void CollectKey()
{
    keyIsCollected = true;
    uimanager.UpdateCoins(keyIsCollected);
}

public void OpenDoor()
{
    _canOpenDoor = true;
}

},

I solved it, the problem was the difference in collisiondetection as rigidbodies to colliders and charactercontroller to colliders.

for charactercontroller neither ontriggerenter or oncollisionenter works instead you use the
oncontrollercollider hit function…
its hard for a absolute beginner to even understand whats the real problem i guess