My pathfinding npc keeps getting stuck then just stays there and jumps

here is a video of it:


the problem is, is that when there is some obstacles they seem to just jump around that obstacle for like forever until I move to a new place and at some point it then stops and follows me afterwards.
There are things I’m certain of that is not causing this:
Anything other than logic errors (no errors or warnings in my output)
The npc are blocking each other (this jumping behavior also occurs with just 1 npc)
because the obstacle is unanchored (this behavior is applicable even if it is anchored)
this is the script im using:

local npc = script.Parent
local human = npc.Humanoid

local PFS = game:GetService("PathfindingService")
local RUNSERVICE = game:GetService("RunService")

local touchedHumanoids = {}

local attackCooldown = npc.aiAttributes.attackCooldown.Value
local damage = npc.aiAttributes.damage.Value

local debounce = false

npc.Humanoid.WalkSpeed = npc.aiAttributes.speed.Value

npc.PrimaryPart:SetNetworkOwner(nil)

local function findTarget()
	local players = game:GetService("Players"):GetPlayers()
	local nearesttarget
	local maxDistance = 5000 -- distance

	for i,player in pairs(players) do
		if player.Character then
			local target = player.Character
			local distance = (npc.HumanoidRootPart.Position - target:WaitForChild("HumanoidRootPart").Position).Magnitude

			if distance < maxDistance then
				nearesttarget = target
				maxDistance = distance
			end

		end
	end
	return nearesttarget
end

local function getPath(destination)
	local path = PFS:CreatePath { 
		AgentCanClimb = true,
		AgentCanJump = true
	}
	path:ComputeAsync(npc.HumanoidRootPart.Position, destination)
	return path
end

local function pathFindTo(destination)
	local path = getPath(destination)
	local target = findTarget()

	if target and target.Humanoid.Health > 0 then
		for i,waypoint in pairs(path:GetWaypoints()) do

			if waypoint.Action == Enum.PathWaypointAction.Jump then
				human.Jump =true
			end

			human:MoveTo(waypoint.Position)
			human.MoveToFinished:Wait()

		end
	end
end

npc.hitBox.Touched:Connect(function(hit)
	local character = hit:FindFirstAncestorWhichIsA("Model")
	if character then
		-- check if the touched object is a character
		if character:FindFirstChild("Humanoid") and game.Players:FindFirstChild(character.Name) then
			if not character.HumanoidRootPart:FindFirstChild("iAmOhio") then
				if touchedHumanoids[character.Name] then
					if tick() - touchedHumanoids[character.Name] > attackCooldown then
						touchedHumanoids[character.Name] = tick()
						character.Humanoid.Health -= damage
					end
				else
					touchedHumanoids[character.Name] = tick()
					character.Humanoid.Health -= damage
				end
			end
		end
	end
end)

RUNSERVICE.Heartbeat:Connect(function()
	local target = findTarget()

	if target then
		pathFindTo(target:WaitForChild("HumanoidRootPart").Position)
	end
	
	if human.Health <= 0 and debounce == false then
		debounce = true
		game.ReplicatedStorage.values.aiKilled.Value += 1
		game.ReplicatedStorage.events.visualizeDeath:FireAllClients(npc, npc.HumanoidRootPart.Position)
		npc:Destroy()
	end
end)