Pathfinding bugging out? No possible problem found

Hi,

I’m using pathfinding to make this girl walk to the player. All of the parts around her are not colliding, the players body and the girls body are not colliding and i have no idea what the problem is anymore. I set the agentHeight and agentRadius to 1, made jumping possible and debugged my entire script.

What could possibly be the problem?

function Stage3:InitPathfinding()
	local GirlMagazine = game.Workspace:FindFirstChild("MagazineGirl")
	local Humanoid = GirlMagazine:FindFirstChild("Humanoid")
	local function checkMagnitude(obj1, obj2)
		return (obj1.Position - obj2.Position).Magnitude
	end

	local function followPath(destination)
		print('follow function called')
		if mustFollow == true then
			print('mustfollow = true')
			destination = self.Player.Character or self.Player.CharacterAdded:Wait()
			local pos = GirlMagazine.PrimaryPart.Position

			local succes, err = pcall(function()
				Path:ComputeAsync(pos, destination.PrimaryPart.Position)
				print('computed a sync')
			end)

			if succes and Path.Status == Enum.PathStatus.Success then
				print('was succesful')
				waypoints = Path:GetWaypoints()

				blockedConnection = Path.Blocked:Connect(function(blockedIndex)
					if blockedIndex >= nextWaypointIndex then
						blockedConnection:Disconnect()
						followPath()
					end
				end)

				if not reachedConnection then
					reachedConnection = GirlMagazine.Humanoid.MoveToFinished:Connect(function(reached)

						local obj1 = GirlMagazine.HumanoidRootPart
						local obj2 = self.Player.Character.HumanoidRootPart or self.Player.CharacterAdded:Wait().HumanoidRootPart

						if checkMagnitude(obj1, obj2) < 5 then
							obj2.Parent.Humanoid.Health = 0
							mustFollow = false
							GirlMagazine.Parent = Assets.Models

							GirlMagazine:SetPrimaryPartCFrame(workspace['Stage3'].girlSpawn.CFrame)
						end

						if reached and nextWaypointIndex < #waypoints then
							nextWaypointIndex += 1
							GirlMagazine.Humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
							followPath()
						else
							followPath()
						end
					end)
				end

				nextWaypointIndex = 2
				if waypoints[nextWaypointIndex] then
					GirlMagazine.Humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
				end
			else
				followPath()
			end
		end
	end

	followPath()

end

Hi! I can help you solve this with 2 method. First is check out this pathfinding script I use :

local route = game.Workspace.Guard1MovePart --It can be a Vector3 value too
local dummy = script.Parent.Parent.Parent
local humanoid = dummy.Humanoid

local PathfindingService = game:GetService("PathfindingService")
while true do
	local path = PathfindingService:CreatePath()

	path:ComputeAsync(dummy.HumanoidRootPart.Position, route.Position)

	local waypoints = path:GetWaypoints()


	for i = 1, 5 do
		if i <= #waypoints then
			if waypoints[i].Action == Enum.PathWaypointAction.Jump then
				humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			end
			humanoid:MoveTo(waypoints[i].Position)
			humanoid.MoveToFinished:Connect(function()
				
				--Killing jumpscare or something
				
			end)
		end
	end
end

If you can’t find the player, check out my post here : How to make a NPC that will kill every dummy in your game! - Resources / Community Tutorials - DevForum | Roblox

If it’s not working, set the parts near her CanCollide false, it can fly glitch the NPC too.

As i stated in the post above. I did all of those steps. Also the actual pathfinding script is not the problem, it was made roblox themselves.