I know how to use pathfinding to generate a path for the NPC to follow but i haven't found any way to make the NPC follow a specific path i built.
This is the script
local myRoot = script.Parent:WaitForChild('HumanoidRootPart')
local myHum = script.Parent:WaitForChild('Humanoid')
local part = game.Workspace.Path
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(myRoot.Position, part.Position)
local points = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(points) do
myHum:MoveTo(v.Position)
myHum.MoveToFinished:wait()
if v.Action == Enum.PathWaypointAction.Jump then
myHum.Jump = true
end
end
end
Here's the path that i want my NPC to walk on but as you can see, it just finds the shortest route rather than follow the path. So i wonder if there's a way to manually generate the waypoints and create the path using scripts.

3 comments
I'm pretty sure you should create more parts in the workspace and make the npc go from one part to another, and not just one part in the beginning and in the end.
That does seem like it could work, ima test it out thanks!
Yeah it works, i simply made 2 shorter checkpoints and created a path to each one of them.