It’s easy! the pathing function is returning a table
waypoints={[1]=CFrame(),
[2]=CFrame as well,
etc}
Your for i,waypoint in waypoints do is going through that table in sequence and using the humanoids moveto to move the player character.
But if your function is running on its own thread while you are looping the update paths function every .1 seconds. You have to tell it to stop navigating the array. or it will continue until completed. Which will cause your npcs to not move or stutter their movements