Pathfinding agent ignoring Costs

  1. Pathfinding agent ignoring Costs

  2. After setting the material costs in my pathfinding script the agent seems to ignore them completly and takes his own path

  3. I tried setting the cost to 1000 but it didn’t help. And setting plastic to math.Huge but that didn’t do anything

This is my code:

pathService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local finish = game.Workspace.BegginerTable.npcWalkUp
local human = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("HumanoidRootPart")

local path = pathService:CreatePath({
	Costs = {
		Concrete = 1000,
		--Plastic = math.huge
	}
})

path:ComputeAsync(torso.Position, finish.Position)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
	human:MoveTo(waypoint.Position)
	human.MoveToFinished:Wait()
end

human:MoveTo(finish.Position)

Thanks!

The agent will not walk on concrete because the cost is too high.

Remember that the cost is how much the agent should not go to that material/label.

I feel really dumb Thanks! Should have read it better. :grinning:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.