Pathfinding doesn’t work, I don’t know why. There’s nothing obstructing it.
Function that pathfinds:
function walkTo(destination)
local pathParams = {
["AgentHeight"] = 6.2,
["AgentRadius"] = 4,
["AgentCanJump"] = false
}
local path = pathfindingService:CreatePath(pathParams)
path = path:ComputeAsync(char.Torso.Position, workspace.testwAYPOINT.Position)
for index, waypoint in pairs(path:GetWaypoints()) do
local visual = Instance.new('Part', workspace)
visual.Size = Vector3.new(4, 4, 4)
visual.Material = 'Neon'
visual.Shape = 'Ball'
end
for index, waypoint in pairs(path:GetWaypoints()) do
print("Moving To:", waypoint.Position)
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
i think a pcall should fix it?
if not, try getting rid of the pairs
local succ, err, = pcall(function()
path:ComputeAsync(params)
end
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success and #waypoints > 0 then
return waypoints
end
EDIT:
try doing a for loop like this for movement, i think that should also do it:
function MoveTo(waypoints, humanoid: Humanoid)
for i = 1, #waypoints do
local waypoint: PathWaypoint = waypoints[i]
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
VisualizePath(waypoint)
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end