local dummy = game.Workspace.Dummy:WaitForChild("HumanoidRootPart")
local human = dummy:WaitForChild("Humanoid")
local point = game.Workspace.Part1
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath()
path:ComputeAsync(dummy.HumanoidRootPart.Position, point.Position)
local waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
human:MoveTo(waypoint.Position)
human.MoveToFinished:Wait()
end
✓ ANSWER ACCEPTED
Im am trying to make a npc move with pathfinding service, but it wont move, any know why?
1 answer
✓ Accepted answer
The pathfinding service only works if the humanoid has somewhere to move to, and it seems like you tell the humanoid to move to what position, therefore the script doesn't know what the destination is. After your in pairs loop, add a human:MoveTo(point.Position) and it should work.
local dummy = game.Workspace.Dummy:WaitForChild("HumanoidRootPart")
local human = dummy:WaitForChild("Humanoid")
local point = game.Workspace.Part1
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath()
path:ComputeAsync(dummy.HumanoidRootPart.Position, point.Position)
local waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
human:MoveTo(waypoint.Position)
human.MoveToFinished:Wait()
end
human:MoveTo(point.Position)
1 comment
0
Ok, thanks!
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
is your dummy anchored? there is no issue in the script, so you might wanna check that.
its unanchored
It's something with the dummy, I tested it and it worked
ok