My NPC just ignores me and gets stuck on the wall

image

the AI gets stuck everytime it fails a jump or I’m far.

Main Script

local function PathFinding(Character : Model)
	
	assert(Character, "NOT A CHARACTER OR NIL!")
	
	local Path = Zombies[Character]
	local STATUS
	
	local Character = Character
	local HumanoidRootPart = Character.PrimaryPart
	local Humanoid : Humanoid = Character:WaitForChild("Humanoid")
	
	local Settings = require(Character.SETTINGS)
	
	HumanoidRootPart:SetNetworkOwner(nil)
	
	Humanoid.Seated:Connect(function()
		Humanoid.Jump = true
	end)
	
	local PlayerRoot = DETECTION:DetectPlayer(Character, Settings.AggroRange)
	
	pcall(function()
		
		STATUS = NPCFUNCTION:FollowDestination({HumanoidRootPart.Position, PlayerRoot.Position, Character}, Path)
		
	end)
	
	if STATUS and STATUS == Enum.PathStatus.Success then
		NPCFUNCTION:Attack({Character, PlayerRoot.Parent}, Settings.Damage)
	end
	
end

ModuleScript

function NPC:FollowDestination(Destinations : {any}, Path : Path)
	
	local Character : Model = Destinations[3]
	local HumanoidRootPart = Character.PrimaryPart
	local Humanoid : Humanoid = Character:WaitForChild("Humanoid")

	local Waypoints, NextWaypoints, ReachedConnection, BlockedConnection

	local Success, Fail = pcall(function()
		Path:ComputeAsync(Destinations[1], Destinations[2])
	end)

	if Success and Path.Status == Enum.PathStatus.Success then

		Waypoints = Path:GetWaypoints()

		BlockedConnection = Path.Blocked:Connect(function(BWP)

			if BWP >= NextWaypoints then
				BlockedConnection:Disconnect()
				NPC:FollowDestination(Destinations, Path)
				return
			end

		end)

		if not ReachedConnection then

			ReachedConnection = Humanoid.MoveToFinished:Connect(function(Reached)

				if Reached and NextWaypoints < #Waypoints then
					
					NextWaypoints += 1
					
					if Waypoints[NextWaypoints].Action == Enum.PathWaypointAction.Jump then
						Humanoid.Jump = true
					end
					
					Humanoid:MoveTo(Waypoints[NextWaypoints].Position)
					
				else
					
					ReachedConnection:Disconnect()
					BlockedConnection:Disconnect()
					
					NPC:FollowDestination(Destinations, Path)
					
					return
						
				end
				
			end)

			NextWaypoints = 2
			Humanoid:MoveTo(Waypoints[NextWaypoints].Position)
			
			if Waypoints[NextWaypoints].Action == Enum.PathWaypointAction.Jump then
				Humanoid.Jump = true
			end

		end

	end
	
	return Path.Status
	
end