Pathfinding not working

Hey, I’m using PathfindingService and I noticed that when I set CanJump off for the agent, It very rarely is able to compute a path, even if there’s a clear straight line there. It is only able to compute a path when the agent is very close to the goal or at completely random instances.

my setup:

As you can see, a straight line.

Here’s my basic test code:

local debris = game:GetService("Debris")
local rs = game:GetService("ReplicatedStorage")
local ts = game:GetService("TweenService")
local pathfinding_serv = game:GetService("PathfindingService")

local modules = rs.Modules

local controller = script.Parent:FindFirstChildOfClass("AngularVelocity")

local goal = Vector3.new(-105.14289855957031, 1.4822783470153809, -47.4920654296875)

local speed = 10

local agent_params = {
	AgentCanJump = false,
}

local path = pathfinding_serv:CreatePath(agent_params)

function MoveToGoal(goal : Vector3)
	local direction = (goal - script.Parent.PrimaryPart.Position).Unit

	local angular_velocity = Vector3.new(direction.Z, 0, -direction.X) * speed

	local tween = ts:Create(controller, TweenInfo.new(
		0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.In
		), {AngularVelocity = angular_velocity})
	
	tween:Play()
end

while task.wait(1) do
	local my_pos = script.Parent.PrimaryPart.Position
	
	path:ComputeAsync(my_pos, workspace.GOAL.Position)
	
	print(path:GetWaypoints())
	
	if path.Status == Enum.PathStatus.Success then
		for _,v in path:GetWaypoints() do
			local part = Instance.new("Part")
			part.Size = Vector3.new(1,1,1)
			part.CanCollide = false
			part.Anchored = true
			part.Parent = workspace
			part.Position = v.Position

			debris:AddItem(part, 0.2)

			print(v.Position)
			MoveToGoal(v.Position)
		end
	end
end

Yeah I’m just really confused why It can’t compute a path.

Any help would be great.

Fixed; the agent was trying to pathfind onto itself, meaning that it had to constantly jump. I just figured out a line between the agent and goal, then moved a few studs up that, and then pathfinded from there.

extra note btw: A better result is to just set the agent to a humanoid, not sure why I never thought of this.. :confused: