So I start the game the zombie will not move I can move it if I walk up to it and push it but it wont moveTo as I want following the path the path shows no errors hears the script.
local model = Instance.new("Model")
model.Name = "Points"
model.Parent = game.Workspace
while true do
for i, v in pairs(game.Players:GetPlayers()) do
local torsop = v.Character.Torso.Position
local zombies = game.Workspace.Zombies:GetChildren()
for i = 1, #zombies do
if (zombies[i].Torso.Position - torsop).magnitude < 500 then
repeat
local pathfinding = game:GetService("PathfindingService")
function vpath(path)
model:ClearAllChildren()
points = path:GetPointCoordinates()
for _, point in ipairs(points) do
local part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(0.5,0.5,0.5)
part.Position = point
part.Anchored = true
part.CanCollide = false
part.Parent = model
end
end
local start = script.Parent.Torso.Position
local Target = v.Character.Torso.Position
local path = pathfinding:ComputeRawPathAsync(start, Target, 500)
vpath(path)
coroutine.resume(coroutine.create(function()
while true do
local check = points:GetChildren()
if #check > 0 then
for _, poi in ipairs(points) do
script.Parent.Humanoid:MoveTo(poi)
end
end
wait(.1)
end
end))
if path.Status == Enum.PathStatus.FailStartNotEmpty or path.Status == Enum.PathStatus.FailFinishNotEmpty then
print("Compute failed")
return {}
end
wait()
until (start - Target).magnitude < 3 or v.Character.Humanoid.Health == 0
else
print("Not Close Enough!")
end
end
end
wait(.1)
end

3 comments
overcomplicated ai lol
You have made infinite loops in infinite loops?? You need to rethink this code.
ok