Pathfinding not working with auto-generated maze?

me and a team of devs are making a game where npcs chase you in a maze.
the npc is supposed to listen to sounds that are played and chase the loudest one.
before, we were using a hand-built maze, but decided to switch over to auto-generated mazes.
this created a problem.

External Media

as shown in the video above, when i walk, or throw an empty can at a wall, it should attract the npc towards it.
however, it only works if the sound is DIRECTLY near the npc (around 6 studs at most from eyeballing) and otherwise does not move

another thing i noticed is the pathfinding returns “NoPath”, even though the path is literally clear as day.
any help?

this honestly might just be a roblox issue because its going to hell rn

it was NOT a roblox issue, i still need help with this.

also ive tried using pathfinding modules like simplepath, but they didnt work.

Just finished a game something like this Maze-Master-Generator
Well, enough to publish anyways for now …

Anyways. This was super hard to pull off in a complexed maze. I ended up creating system that showed the path in real-time the NPC’s were calculating. It really helped see the problems I was having with them. Without it I’m sure I would have never figured out the bugs I was having. This is pulling a “dot” just a ball part named Dot from ReplicatedStorage. You’ll have to create that.

--part of the moduleScript (enough to use to for debugging)

local ds=game:GetService("Debris")
local path=workspace:WaitForChild("Folder")
local rp=game:GetService("ReplicatedStorage")
local Dot=rp:WaitForChild("Dot")

local module = {}
function module.removeDots()
	for _, dot in ipairs(path:GetChildren()) do
		ds:AddItem(dot,0) --*
function module.removePath()
	ds:AddItem(path,0) --*	
function module.createDots(waypoints)
	for i, waypoint in ipairs(waypoints)do
		local dot=Dot:Clone();dot.Color=botDot()
		local point=(waypoint.Position)
		waypoint=(, point.Y, point.Z))
		--ds:AddItem(dot,3) --Debris
-- other functions --
return module

This is more of a debugging tool. I hope it helps.
Also, this is using pathfinding for waypoints.

ive fixed one of the issues i was having (i was creating a new pathfinding path every frame instead of having it at the start of the script)
however, the path doesnt calculate at all if the path is very long. it just returns “NoPath” even though there is clearly a path, since the maze has no blocked off regions.
i cant use this to debug since it relies on waypoints: something my script isnt generating.

This not only helped me see my bugs, but latter helped me fine tune how they reacted.
Really need to make sure you take care in how you handle no-path as they will hang on that.

Adding the Agents option to Pathfinder is also crucial to performance

This is just a snip so not all of it will make sense.

local pf=game:GetService("PathfindingService")

local Agents={WaypointSpacing=(5),

f:ComputeAsync(PrimaryPart.Position,t) w=(f:GetWaypoints())