Why isn't this script moving the NPC?

I want my script to move the character by using :MoveTo so I can later on add an animation to it. I’ve never used PathFindingService…

The character isn’t anchored and here is my script:

local Storage = game.ServerStorage
local Character = Storage:FindFirstChild(Char):Clone()
Character.Parent = workspace
local Humanoid = Character:FindFirstChild("Humanoid")
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath()
path:ComputeAsync(Character.HumanoidRootPart.Position, workspace.GoalPart.Position)
local waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
	Humanoid:MoveTo(waypoint.Position)
	Humanoid.MoveToFinished:Wait()
end

Have you fogotten to define Char? I tested your script and this was the only error, as it that variable name has not been defined. If you have an NPC in ServerStorage with the name “Char”, then it should be written as

local Character = Storage:FindFirstChild("Char"):Clone()
2 Likes

The character “spawns” in. The problem is that the character doesn’t move.

This happened to be either ur NPC’s humanoidRootpart is anchored so unanchor that, or u have a weld inside of the NPC so search up “weld” in explorer

2 Likes