I have this code that is supossed to spawn an enemy and then move them towards a brick in the workplace. The NPC spawns just fine but it does not move at all and just stands there. I also get no error in the output.
local PathfindingService = game:GetService("PathfindingService")
local Enemies = game:GetService("ServerStorage"):WaitForChild("Enemies")
local SpawnPoints = {workspace:WaitForChild("SpawnPoints").SP1,
workspace:WaitForChild("SpawnPoints").SP2,
workspace:WaitForChild("SpawnPoints").SP3}
local EndPoints = {workspace:WaitForChild("EndPoints").EP1,
workspace:WaitForChild("EndPoints").EP2,
workspace:WaitForChild("EndPoints").EP3}
local ran = math.random(1,3)
local RaiderClone = Enemies.Raider:Clone()
RaiderClone.Parent = workspace
RaiderClone.HumanoidRootPart.CFrame = SpawnPoints[ran].CFrame
local path = PathfindingService:CreatePath()
path:ComputeAsync(RaiderClone.UpperTorso.Position,workspace.EndPoints.EP1.Position)
local Waypoints = path:GetWaypoints()
for i,waypoint in pairs(Waypoints) do
RaiderClone.Humanoid:MoveTo(waypoint.Position)
RaiderClone.Humanoid.MoveToFinished:Wait(2)
end

1 comment
Replace local spawn points and local end points and put this instead