I am setting up a PathFinding system so I can start learning it, but for some reason, the “AgentRadius” just won’t work as it should. It just does not make difference at all.
Without AgentRadius:
With AgentRadius (at 6):
This is the script:
wait(1)
local PathfindingService = game:GetService("PathfindingService")
local npc = script.Parent
local humanoid = npc:FindFirstChild("Humanoid")
local goal = workspace.goal
local path = PathfindingService:CreatePath({
AgentCanJump = true,
AgentRadius = 6,
Costs = {
Wood = 1,
Neon = 2,
},
})
local success, errorMessage = pcall(function()
path:ComputeAsync(npc.HumanoidRootPart.Position, goal.Position)
end)
if success and path.Status == Enum.PathStatus.Success then
for _, waypoint in pairs(path:GetWaypoints()) do
local part = Instance.new("Part")
part.Material = Enum.Material.Neon
part.Anchored = true
part.CanCollide = false
part.Position = waypoint.Position
part.Shape = Enum.PartType.Ball
part.Size = Vector3.new(1,1,1)
part.Parent = workspace
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid.MoveToFinished:Wait()
end
else
warn("errorMessage", errorMessage)
end