wait(1)
local char = script.Parent
local primarypart = char.PrimaryPart
local humanoid = char.Humanoid
primarypart:SetNetworkOwner(nil)
local pathpoints = workspace.Pathpoints
for pathpoint = 1, #pathpoints:GetChildren() do
local goal = pathpoints[pathpoint]
local pfs = game:GetService("PathfindingService")
local path = pfs:CreatePath(
{
AgentRadius = 0,
AgentHeight = char:GetExtentsSize().Y,
AgentCanJump = true,
Costs = {
CrackedLava = math.huge,
Path = 1,
Plastic = 1
},
WaypointSpacing = math.huge
}
)
local success, errormessage = pcall(function()
path:ComputeAsync(primarypart.Position, goal.Position)
end)
if success and path.Status == Enum.PathStatus.Success then
local waypoints = path:GetWaypoints()
for i, v in pairs (waypoints) do
print(i)
humanoid:MoveTo(v.Position)
humanoid.MoveToFinished:Wait()
end
elseif success and path.Status == Enum.PathStatus.NoPath then
warn("no Path ", errormessage)
elseif not success then
warn("no Compute ", errormessage)
end
end
error("NPC Finished Course")
This is trash, i want to use the Pathfinding system and not the SIMPLE Humanoid MoveTo function…
Not only do I want them to go BORING straight, I want them to go around curves, that is, in an arc, and not move towards the point and then just turn like that.
Instead of doing humanoid.MoveToFinished:Wait() you should continuously check whether the npc is close enough to the current point, if so then go to the next point.
That way the npc won’t overshoot the checkpoints like in your video.
Doing humanoid.MoveToFinished:Wait() works in BrokenV0id’s video because the npc is moving very slowly.
It’s a module for generating points from fewer points. You can use those points however you like, whether it be tweening or moving a humanoid with MoveTo…