-- NPC ПАНИКА — бегают хаотично как учёные в страхе
local npcs = workspace:WaitForChild("NPCs")
function setupPanic(npc)
local humanoid = npc:WaitForChild("Humanoid")
local torso = npc:WaitForChild("Torso")
-- Бесконечный цикл паники
while true do
if humanoid and humanoid.Health > 0 then
-- Случайная точка в радиусе 30 studs
local randomPos = torso.Position + Vector3.new(
math.random(-30, 30),
0,
math.random(-30, 30)
)
-- Бежим туда
humanoid:MoveTo(randomPos)
humanoid.MoveToFinished:Wait()
-- Паника: быстрая пауза или вообще без паузы
wait(math.random(0.1, 1))
end
end
end
-- Ждём загрузки всех NPC
wait(3)
-- Настраиваем каждого NPC
for _, npc in pairs(npcs:GetChildren()) do
if npc:IsA("Model") and npc:FindFirstChild("Humanoid") then
setupPanic(npc)
end
end
print("NPC в панике запущены!")