Advertisement
CODINGGIAN

Untitled

Apr 1st, 2025
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local places = game.Workspace.Locations:GetChildren()
  2. while true do
  3.     if game.ReplicatedStorage.ActiveGame.Value == true then
  4.         if game.ReplicatedStorage.ZombiesToGenerate.Value > 0 then
  5.             local newZombie = game.ReplicatedStorage.Zombie:Clone()
  6.             local root = newZombie:FindFirstChild("HumanoidRootPart")
  7.             local randomPlace = math.random(1, #places)
  8.             local randomX = math.random(-10,10)
  9.             local randomZ = math.random(-10,10)
  10.             root.Position = Vector3.new(
  11.             places[randomPlace].Position.X + randomX,
  12.             6 ,
  13.             places[randomPlace].Position.Z + randomZ)
  14.             newZombie.Parent = workspace.Zombies
  15.             game.ReplicatedStorage.ZombiesToGenerate.Value -= 1
  16.         end
  17.     end
  18. wait(0.2)
  19. end
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement