Need help with AI-Movement

Hello, I recently started using A* and I’m having issues.
I’ve added Debug logging into most of it, its Generating a path,Waypoints but not moving. I created a Simple Move method and the npc moved non-stop which is what I was trying to achieve but tried to get it to move to the waypoints and I’m messing up something.
If anyone could point me in the right direction or point out my mistake it’d be greatly appreciated.

using Pathfinding;
using UnityEngine;

public class NPCMovement : MonoBehaviour
{
    private Path path;
    private int currentWaypoint = 0;
    public float speed = 2f;
    public float waypointReachDistance = 0.1f;
    private Vector3[] pathWaypoints;

    public void SetPath(Path p)
    {
        path = p;
        currentWaypoint = 0;
        pathWaypoints = p.vectorPath.ToArray();
        Debug.Log(gameObject.name + " received " + pathWaypoints.Length + " waypoints.");
    }
    public void TakeTurn()
    {
        Debug.Log(gameObject.name + " is taking a turn.");

        if (path == null) return;

        if (currentWaypoint >= pathWaypoints.Length) return;

        Vector3 direction = (pathWaypoints[currentWaypoint] - transform.position).normalized;
        transform.position = Vector3.MoveTowards(transform.position, pathWaypoints[currentWaypoint], speed);

        Debug.Log(gameObject.name + " moving towards: " + pathWaypoints[currentWaypoint]);

        if (Vector3.Distance(transform.position, pathWaypoints[currentWaypoint]) < waypointReachDistance)
        {
            currentWaypoint++;
            if (currentWaypoint >= pathWaypoints.Length)
            {
                Debug.Log(gameObject.name + " reached destination.");
                path = null;  // Reset path once destination is reached
            }
        }

        Debug.Log(gameObject.name + " is at position " + transform.position);
    }

}