Pathfinder Gets Stuck Under roofs

Hii, so i have a pathfinder that does the basics, But i noticed something was off, It never jumps, and when under roofs/ when i am above a roof, it gets stuck

my code : (not full)

while true do
	game:GetService("RunService").Heartbeat:wait()
	local target = getNearestTarget()
	if not goingToCave then
		if target then
			pathfindPosition = target.PrimaryPart.Position
                  local pathfindPosition = Vector3.new()


local agentParameters = {
	AgentHeight = 5, -- 5
	AgentRadius = 2, --  2
	AgentCanJump = true,
	AgentCanClimb = true,
	Costs = {}
}

local pathfind = false
			
			local position1 = character.PrimaryPart.Position + Vector3.new(0,1.5,0)
			local position2 = pathfindPosition + Vector3.new(0,1.5,0)

			local raycastParams = RaycastParams.new()
			raycastParams.FilterType = Enum.RaycastFilterType.Exclude
			if target then
				raycastParams.FilterDescendantsInstances = {character,target}
			else
				raycastParams.FilterDescendantsInstances = {character}
			end

			local raycast = workspace:Raycast(
				position1,
				position2 - position1,
				raycastParams
			)
			
			
			
			if raycast then
				pathfind = true
			end
	
			if pathfind then
			

				if humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then
					--	simplepath:Run(character.HumanoidRootPart.Position)
					simplepath:Run(pathfindPosition)
				end
					
			else
				lookAt(character, target)
				humanoid:MoveTo(target.HumanoidRootPart.Position)
                        end

The only line i changed from SimplePath :

local pathComputed, _ = pcall(function()
		self._path:ComputeAsync(self._agent.PrimaryPart.Position - Vector3.new(0, self._agent.PrimaryPart.Size.Y/0, 0), (typeof(target) == "Vector3" and target) or target.Position)
	end)

image

And there’s actually a way of reaching the player, by climbing this

It only comes back to his senses when i get down

1 Like

reeeeeduuuuuuuuuceeeeeeeeee the agentheighttttttttttttttt