Advertisement
Guest User

RoundScript

a guest
Feb 28th, 2021
1,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. local zombieCount = game.ReplicatedStorage:WaitForChild("ZombiesRemaining")
  2. local zombiesAlive = game.ReplicatedStorage:WaitForChild("ZombiesAlive")
  3. local gameInProgress = game.ReplicatedStorage:WaitForChild("GameInProgress")
  4. local wave = game.ReplicatedStorage:WaitForChild("Wave")
  5. local roundMsg = game.ReplicatedStorage:WaitForChild("RoundMsg")
  6. local roundTime = game.ReplicatedStorage:WaitForChild("RoundTime")
  7. local finalWave = game.ReplicatedStorage:WaitForChild("FinalWave")
  8. local timeToWar = game.ReplicatedStorage:WaitForChild("TimeToWar")
  9. local counter = game.ReplicatedStorage:WaitForChild("Counter")
  10. local boss = game.ReplicatedStorage:WaitForChild("Boss")
  11. local timeAfterGame = game.ReplicatedStorage:WaitForChild("TimeAfterGame")
  12.  
  13. while true do
  14.  
  15.     for i = timeToWar.Value, 0, -1 do
  16.         roundMsg.Value = "Game Starting in: " .. i
  17.         wait(1)
  18.     end
  19.  
  20.     counter.Value = roundTime.Value
  21.     zombieCount.Value = 5
  22.     zombiesAlive.Value = 5
  23.     wave.Value = 1
  24.     gameInProgress.Value = true
  25.  
  26.     repeat
  27.         if counter.Value == 0 then
  28.             roundMsg.Value = "You lost!"
  29.             game.Workspace.Zombies:ClearAllChildren()
  30.             gameInProgress.Value = false
  31.         else
  32.             roundMsg.Value = "Round: " .. wave.Value .. " Time: " .. counter.Value
  33.             wait(1)
  34.             counter.Value = counter.Value - 1
  35.         end
  36.  
  37.         if zombiesAlive.Value == 0 then
  38.  
  39.             wave.Value = wave.Value + 1
  40.  
  41.             if wave.Value == finalWave.Value + 1 then
  42.                 roundMsg.Value = "Congratulations, you win!!!"
  43.                 gameInProgress.Value = false
  44.             else
  45.                 for i = timeToWar.Value, 0, -1 do
  46.                     roundMsg.Value = "Next wave in: " .. i
  47.                     wait(1)
  48.                 end
  49.  
  50.                 counter.Value = roundTime.Value
  51.                 zombieCount.Value = 1 * wave.Value
  52.                 zombiesAlive.Value = 1 * wave.Value
  53.  
  54.                 if wave.Value == finalWave.Value then
  55.                     local copy = boss:Clone()
  56.                     copy.Parent = game.Workspace.Zombies
  57.                     zombiesAlive.Value = zombiesAlive.Value + 1
  58.                 end
  59.  
  60.             end
  61.         end
  62.  
  63.  
  64.     until gameInProgress.Value == false
  65.     wait(timeAfterGame.Value)
  66. end
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement