How to make an object get destroyed when only the player enters a trigger collider? C#

I want to make an object get destroyed when the player is inside a trigger and he presses “E”

If you give the player the tag “Player” you could add this to the destroyable gameobject having the trigger.

    // OnTriggerStay is called once per frame for every Collider other that is touching the trigger
    void OnTriggerStay(Collider other)
    {
        if (Input.GetKey(KeyCode.E) && other.CompareTag("Player"))
        {
            Destroy(gameObject);
        }
    }