I’m currently trying to learn pathfinding via a tutorial on Youtube(Devking one) and was wondering if this code is deprecated or something and what the alternative is, because the NPC doesn’t move at all
local pfs = game:GetService("PathfindingService")
local hum = script.Parent:WaitForChild("Humanoid")
local hrp = script.Parent:WaitForChild("HumanoidRootPart")
local path = pfs:CreatePath()
path:ComputeAsync(hrp.Position,workspace.endpart.Position)
local waypoints = path:GetWaypoints()
for i,waypoint in ipairs(waypoints) do
hum:MoveTo(waypoint.Position)
hum.MoveToFinished:Wait()
end
hum:MoveTo(game.Workspace.endpart.Position)