Pathfinding not going my position what i want

I have problem about this pathfinding dummy always Go Another Waypoint earlier anyone have idea to fix it?

robloxapp-20210924-1514158.wmv (2.3 MB)

local Pathfiding = game:GetService("PathfindingService")
local Body = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso")
num = 1

while true do
local Pointpart = game.Workspace.PointPart:FindFirstChild("Point"..num)
Body:MoveTo(Pointpart.Position)
	Body.MoveToFinished:wait(1)
	if Body.MoveToFinished then
	num = num +1
	end
	end

Thanks you :slightly_smiling_face:

I’m pretty sure its because they think they already reached the point. Also try to re-read Pathfinding because it gives a lot of useful information on how to properly use this service

When you do Body.MoveToFinished:Wait(), there’s no need to add an if condition below because it will wait until it’s finished. I don’t think you’re supposed to put a number parameter there as well. Also, the wait in Body.MoveToFinished:Wait() should have a capital W I think.

this thing can help but the problem is about dummy think they already reached the point.

Also you are referring to PathfindingService. Either I am blind, or you are not even using it. You should check out the hyperlink in my reply before

Did you actually try what I said?

Already did it and still problem

im reading it it look like i need to make Creating Paths

I have done something similar to this, you might just try to read and change my code

local PathfindingService = game:GetService("PathfindingService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

while wait(math.random(5, 15)) do
	
	local NPC = game:GetService("ReplicatedStorage").NPC:Clone()
	NPC.Parent = workspace
	
	for _, v in pairs(NPC:GetChildren()) do
		if v:IsA("BasePart") then
			v:SetNetworkOwner(nil)
		end
	end

	local Humanoid, Char = NPC.Humanoid, NPC
	local path1 = PathfindingService:CreatePath()

	path1:ComputeAsync(Char.HumanoidRootPart.Position, workspace.AI_IN.Position)

	coroutine.wrap(function()
		local waypoints = path1:GetWaypoints()
		for index, waypoint in pairs(waypoints) do
			Humanoid:MoveTo(waypoint.Position)
			Humanoid.MoveToFinished:Wait()
		end

		local path2 = PathfindingService:CreatePath()
		path2:ComputeAsync(Char.HumanoidRootPart.Position, workspace.AI_OUT.Position)

		local waypoints = path2:GetWaypoints()
		for _, waypoint in pairs(waypoints) do
			Humanoid:MoveTo(waypoint.Position)
			Humanoid.MoveToFinished:Wait()
		end

		wait(1)
		Char:Destroy()
	end)()
end
1 Like