I have a NPC which looks like a panda and has its humanoid,named “p0-abao” and parented to workspace.I read the article :“Character Pathfinding | Documentation - Roblox Creator Hub” and use the demo code as blow:
local PATROL_DELAY = 2
-- Variables for the zombie and its humanoid
local zombie = game.Workspace["p0-abao"]
local humanoid = zombie.Humanoid
-- Variables for the point(s) the zombie should move between
local pointA = Vector3.new(-398.8, -61.5, -509.6) --game.Workspace["Part111"]
local pointB = Vector3.new(-418.6, -61.7, -535) --game.Workspace["Part222"]
-- Variable to keep track of the zombie's next destination
local nextDestinationObject = pointA
-- Loop to move between the two points
while wait(PATROL_DELAY) do
humanoid:MoveTo(nextDestinationObject)
-- Wait until the zombie has reached its target
humanoid.MoveToFinished:Wait()
-- Switch the current target to the other target
if nextDestinationObject == pointA then
nextDestinationObject = pointB
else
nextDestinationObject = pointA
end
end
I place these codes in a script under the ServerScriptService.
but my NPC don’t move and no error message in the output window.WHY?
Thx a lot