Pathfinding Weight Acting weirdly maybe a bug?

I am workng on a npc walk script.
In the game, there are breakable obsticles. By breaking them, npcs can walk through that spot.
I am using the combinateion of path and pathfinding weights to determine wether if its faster to break the obsticle ( which take time ) or to just go aroud it.
The problem Im having is that the path generated is sometimes nowhere near the closes path!

Examples of successs
image

The problem

Is this a studio bug or am I setting up the weights wrong?

You need to send you’re code, it is SCRIPTING support after all.

I didn’t know where to ask this quetion, but I am fairly certain this isn’t a scripting eroor.
Here is my code. I qulled out all the parts that were involved in the pathfinging

local path = PathFindingService:CreatePath({
	AgentRadius = math.max(collider.Size.X, collider.Size.Z),
	AgentHeight = collider.Size.Y,
	AgentCanJunp = false,

	Costs = {
		Fence = 20
	}
})

local currentPos = collider.Position
local targetPos = currentTarget.PrimaryPart.Position
	
path:ComputeAsync(currentPos, targetPos)

here is the obsticle
image
image

“PathfindWeight” has collusion disabled
The “Collider” has "path through’
All the “Parts” have collusion, query, touch disabled

I figured it out myself.
It turns out, pathfinding weight cannnot be too thin. From my testing ,about 4 studss is the minimum.