Hello,
So i’m making a npc that needs to go to a certain position but when I try to get the waypoints it gives thsi error: “GetWayPoints is not a valid member of Path “Instance”” If you can help me please reply!
Here’s the script:
local pfs = game:GetService("PathfindingService")
local human = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("HumanoidRootPart")
local path = pfs:CreatePath()
path:ComputeAsync(torso.Position, game.Workspace.AIParts.HouseSet.Destination.PrimaryPart.Position)
local waypoints
waypoints = path:GetWayPoints()
for i, waypoint in pairs(waypoints) do
human:MoveTo(waypoint.Position)
human.MoveToFinished:Wait(2)
end
human:MoveTo(game.Workspace.AIParts.HouseSet.EndPart.Position)