-
What do you want to achieve?
For the AI to all move correctly, and if there’s an obstacle, it still can go over it. -
What is the issue?
The AI seems to keep moving back and forth, some don’t even move. I can’t use Humanoid:MoveTo(), Otherwise it defeats the purpose of having obstacles.
-
What solutions have you tried so far?
I tried lowering how often the path is redone, but it changed nothing.
function Move()
for i, value in ipairs(Group.Zombies:GetChildren()) do
coroutine.wrap(function()
local Path = PathfindingService:CreatePath({
AgentRadius = 1,
AgentHeight = 3,
AgentCanJump = true,
AgentCanClimb = true,
WaypointSpacing = 0.5,
})
local Success, ErrorMessage = pcall(function()
Path:ComputeAsync(value.HumanoidRootPart.Position, ClosestPosition)
end)
if not Success or Path.Status ~= Enum.PathStatus.Success then
warn(ErrorMessage, Path.Status)
return
end
local Waypoints = Path:GetWaypoints()
for i2, value2 in ipairs(Waypoints) do
value:FindFirstChildOfClass("Humanoid"):MoveTo(value2.Position)
value:FindFirstChildOfClass("Humanoid").MoveToFinished:Wait()
end
end)()
end
end