I am making a pathfinding ai dummy for a game and I get this error what should I do?
local function createPath(position)
local path = pathFindingService:CreatePath()
path:ComputeAsync(root.Position, position)
end
local function moveTo(position)
local path = createPath(position)
for i, waypoint in pairs(path:GetWaypoints()) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
if path.Status == Enum.PathStatus.NoPath then
moveTo(position)
end
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinsished:Wait()
end
end
I get the error: Workspace.AIDummy.AI:42: attempt to index nil with 'GetWaypoints'
I forgot to return the path lol
