How do I make my NPC dodge and jump over obstacles?

I’ve made a script from a tutorial how to make zombie chasing the player and damaging them, but I want to make them not stuck on the wall or obstacles like making them dodge or jump over them, here is what I made:

local zombie = script.Parent
local humanoid = zombie:WaitForChild("Humanoid")

zombie.PrimaryPart:SetNetworkOwner(nil)

local attackDebounce = false

local function Chase()
	local players = game.Players:GetPlayers()
	local maxDistance = 100
	local nearestTarget = nil
	
	for i, player in pairs(players) do
		if player.Character then
			local target = player.Character
			local distance = (zombie.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
			if distance < maxDistance then
				nearestTarget = target
				maxDistance = distance
			end
		end
	end
	
	return nearestTarget
end

local function Attack(target)
	local distance = (zombie.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
	
	if distance > 2.5 then
		humanoid:MoveTo(target.HumanoidRootPart.Position)
	else
		if attackDebounce == false then
			attackDebounce = true
			target.Humanoid:TakeDamage(10)
			wait(0.5)
			attackDebounce = false
		end
	end
end

while wait() do
	local target = Chase()
	if target then
		humanoid:MoveTo(target.HumanoidRootPart.Position)
		Attack(target) -- Damage the target
	end
end

Use PathfindingService to ensure that characters can move between the points without running into walls or other obstacles.

Here’s the link: PathfindingService | Documentation - Roblox Creator Hub

I put the PathfindingService on the chase function, but they still run to the wall and don’t jump over the obstacles

local function Chase()
	local players = game.Players:GetPlayers()
	local maxDistance = 100
	local nearestTarget = nil
	
	local path = pathfindingService:CreatePath({
		AgentRadius = 3,
		AgentHeight = 6,
		AgentCanJump = true
	})
	
	for i, player in pairs(players) do
		if player.Character then
			local target = player.Character
			local distance = (zombie.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
			local success, errorMessage = pcall(function()
				path:ComputeAsync(zombie.HumanoidRootPart.Position, target.HumanoidRootPart.Position)
			end)
			
			if success and path.Status == Enum.PathStatus.Success then
				if distance < maxDistance then
					nearestTarget = target
					maxDistance = distance
				end
			else
				warn("Path not computed!", errorMessage)
			end
		end
	end
	
	return nearestTarget
end

And the error message says nil.

Maybe decrease the traversable value in Height to 3.

Try debug with this: https://create.roblox.com/store/asset/9019193064/Pathfinder?tab=description

I tried to change the AgentHeight value and it’s not working, and tried this plugin and it seems they are not following the path.