Help with path finding service

Hello, so basically, the NPC should go to “CASHIER” position , but for some reason is heading to the door. :confused:
Code:

local function createNpc()
	local NPCTemplate = RepStorage.NPC.NPC:Clone()
	local Template = {Model = NPCTemplate,PersonaAtendiendo = nil,Order = createOrder()}
	local Humanoid = NPCTemplate:WaitForChild("Humanoid")
	local x = PFS:CreatePath()
	NPCTemplate.Parent = workspace.Programming.Restaurant.NPC
	NPCTemplate:MoveTo(workspace.Programming.Restaurant.Entry.Position)
	x:ComputeAsync(NPCTemplate.Torso.Position,workspace.Programming.Restaurant.Cashier.Position)
	local wp = x:GetWaypoints()
	coroutine.wrap(function()
	for i,v in pairs(wp) do
		Humanoid:Move(v.Position)
		Humanoid.MoveToFinished:Wait()
		end
		end)()
end

The problem is most likely in the 7th line, you did a moveto for the door and didn’t tell the npc to stop moving to the door.

Instead of :
NPCTemplate:MoveTo(workspace.Programming.Restaurant.Entry.Position)

Do:NPCTemplate:MoveToFinished(workspace.Programming.Restaurant.Entry.Position)

So that the NPC will stop moving after its reached its destination.

2 Likes

Thanks for reply!
I think you might be wrong, I am teleporting the model!
Models have a function :MoveTo(), I used it to teleport the NPC to restaurant door!
That’s not the trouble :confused:

Take a look at line 12. You are using Move, which is different from MoveTo. Maybe this is the issue.

2 Likes

I forgot how to use MoveTo: LMAO

1 Like