Hi all
I am making a horror game and i was working on the AI of the antagonist and had a break in it but it dosen’t work!
the loop script
local function walkTo(Destination)
local Path = getPath(Destination)
if Path.Status == Enum.PathStatus.Success then
for index, waypoint in pairs(Path:GetWaypoints()) do
local target = findTarget()
if target then
attack(target)
break
else
Humanoid:MoveTo(waypoint.Position)
Humanoid.MoveToFinished:wait()
end
end
else
Humanoid:MoveTo(Destination.Position - (Doll.HumanoidRootPart.CFrame.LookVector * 10))
end
end