NPC will not stop walking to allow the character to interact with it

Alright I have a list of Transforms which are locations that I want my NPC to travel. What I want is onTriggerEnter (which is in a different script) the NPC needs to move to the first array in said list. I have print statements throughout my script showing that all the areas are being called correctly but my NPC still continues to move about through the entire list instead of just that one spot. Any ideas on how to get it to stop moving through the list, other than what I have because it is not working. The setup has a box collider in the area where the NPC is. So the trigger is just when the player gets close to the NPC. Heres the code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class Moveto : MonoBehaviour
{
    //these are the spots the NPCs will go
    public List<Transform> goal;
    public Transform MC;
    private NavMeshAgent agent;
    private bool talkTo;
    private int count;
    // Start is called before the first frame update
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
        count = 0;
        talkTo = false;
    }

    public void move(bool talk)
    {
        print(talk);
        if(talk)
        {
            float speed = 1f * Time.deltaTime;
            agent.destination = Vector3.MoveTowards(goal[count].position, goal[0].position, speed);
        }
        else{
            agent.destination = goal[count].position;
        }
       
        count++;

        if(count == 3)
            count = 0;
    }

    // Update is called once per frame
    void Update()
    {
        //check to see if the MC is talking to NPC
        if(talkTo == false){
            //check to see if destination is reached
            if(!agent.pathPending)
            {
                if(agent.remainingDistance <= agent.stoppingDistance)
                {
                    if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f)
                    {
                        move(false);
                    }
                }
            }
        }
        else{
            print("in else statement");
            move(true);
        }
    }

    public void moveToMC(bool willTalk)
    {
        print("made it to moveToMC function" + willTalk);
        talkTo = willTalk;
    }

}

You should seperate this into two classes/monoBehaviours as these are two independent features. One is Talking, one is Walking.
Walking does not need an update method at all - just “WalkToNext()”, “Stop()” (or “Pause()”) and “Continue()”.
Talking should then trigger “WalkToNext()” once the player talked to the NPC.
The whole if(agent.remainingDistance <= agent.stoppingDistance) can be inside a Coroutine if you really need it.

This way, you can test both behaviours independent from each other in the editor.
First you create a customInspector (or just a bool, which is checked in OnDrawGizmos) for your Walking-Script.
Add 3 Buttons which call the methods mentioned above → “WalkToNext()”, “Stop()” (or “Pause()”) and “Continue()”)
Once this is working you can be sure that your Walking Script works fine.

Then you create a customInspector (or just a bool) for your Talking-Script.
Talking probably has something like “OnPlayerInteract()”, which again, can be called from a button in your customInspector - so you don’t have to walk with your Player to the NPC to test the behaviour.
When “OnPlayerInteract()” is called, the Talking-Script will call “WalkToNext()” on your Walking-Script.

Done.

Well put, thanks a ton! can not believe I didn’t think of something like this lol It’s always the small simple things