If statement has 2 conditions, but will trigger even if one isn't met

So, my goal is to be able to start a conversation if I am inside the NPCs trigger collider and if I then press E.

The game is detecting well if I enter or exit the trigger area and will let me trigger the conversation even if I have not entered the trigger area or I entered and then exited.

any help or ideas on how to solve this are very welcomed

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DialogueEditor;

public class SpacemanCharacter : MonoBehaviour
{
    public NPCConversation myConversation;
    private bool isOnConversationArea = false;

    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            isOnConversationArea = true;
            Debug.Log("you are on conversation area");
        }
    }

    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Player")
        {
            Debug.Log("you ARE NOT on conversation are");
            isOnConversationArea = false;
        }
    }

    void Update()
    {
        if (isOnConversationArea = true && Input.GetKeyDown(KeyCode.E))
        {
            Debug.Log("The conversation has started");

            ConversationManager.Instance.StartConversation(myConversation);
        }
    }
}

In your update, you aren’t checking isOnConversationArea correctly.

You have isOnConversationArea = true but it should be isOnConversationArea == true. Missing the other = sign, basically. Right now it is just checking if isOnConversationArea can be set to true, which is can, so regardless of the trigger, it is true. That’s why you can interact outside of the trigger area.

So just add another = and you should be good.

your IDE should really warn you about this type of user errors unless you are using notepad to code?