Moving NPC from point A to B after a trigger?

Sorry, this is probably a super simple question, but I’m struggling.

Basically, I have a box collider set up in my scene. I want it to be where the player will enter the box collider and this will trigger the NPC to move to a specific point. It’s a one time trigger that deactivates.

I’m having two problems. The first is that the NPC’s walk animation doesn’t work. It’ll play for one second and then stop, but I want it to continuously play while he’s walking. The second is that for some reason the NPC just won’t move to the target? This is the code I’m using:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LZBOutsideTrigger : MonoBehaviour
{
[Header(“Zombie Boy Movement”)]
[SerializeField] private Animation myLZB = null;
public Transform target;
public Transform boy;
public float speed;
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag(“Player”))
{
myLZB.Play(“Take001”);
Vector3 a = boy.position;
Vector3 b = target.position;
boy.position = Vector3.MoveTowards(a, b, speed);
gameObject.SetActive(false);
}
}
}

Any help would be very much appreciated!

First, [ code ] tags in the future.

Your issue is that you’re only telling your target to move for the one frame that OnTriggerEnter() is true. You need to set a value, like a “move to your other position” boolean flag that you account for in the moving NPC’s update/logic script.