Pathfinding ignoring cost modifiers?

As you can see here in the video. The white neon cubes represent the maximum cost value for NPCs. I’m trying to make it so they avoid these parts in the math of the path finding. But for some reason it doesn’t work. Maybe my approach is completely wrong.

Here is where the code is ran from. It’s a serverside script inside the character in workspace.

local PathFindingService = game:GetService("PathfindingService")
local Path = PathFindingService:CreatePath({
	AgentRadius = 1,
	WaypointSpacing = .1,
	Costs = {
		 Neon = math.huge,
		 Door = -1
	}
})

local t = RunService.Heartbeat:Connect(function()
	local plr = game.Players:GetChildren()[1]
	local char = plr.Character or plr.CharacterAdded:Wait()

	--local distance = (script.Parent:FindFirstChild('HumanoidRootPart').Position - char.HumanoidRootPart.Position).Magnitude

	--if distance < 8 then return end

	Path:ComputeAsync(script.Parent:FindFirstChild('HumanoidRootPart').Position, char.HumanoidRootPart.Position)
	--task.wait()
	if Path.Status == Enum.PathStatus.Success and Path:GetWaypoints() then
		for v,i in ipairs(Path:GetWaypoints()) do
			local distance = (script.Parent:FindFirstChild('HumanoidRootPart').Position - char.HumanoidRootPart.Position).Magnitude
			print(distance)
			
			if distance < 4 then hum.WalkSpeed = 0  break else hum.WalkSpeed = 4 end
			hum:MoveTo(i.Position)
		end
	else
		warn("can't find path")
	end
end)

--t:Disconnect()

help would be appreciated thx :sob:

You are constantly setting new MoveTo destinations for every waypoint every frame, so the character never actually follows a path here.