Guest User

Untitled

a guest
Jul 17th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. local roundLength = 60
  2. local intermissionLength = 10
  3. local victoryLength = 15
  4. local InRound = game.ReplicatedStorage.InRound
  5. local lobbyspawn = game.Workspace.LobbyAreaSpawn
  6. local gamespawn = game.Workspace.GameAreaSpawn
  7. local deathspawn = game.Workspace.deathspawn
  8. local status = game.ReplicatedStorage.Status
  9. local won = game.ReplicatedStorage.Won
  10.  
  11. local music = game.Workspace.music
  12. local music1 = game.Workspace.music_duplex
  13. local music2 = game.Workspace.music_duplexwon
  14. local trombone = game.Workspace.trombone
  15.  
  16. local runnersTable = game.Teams.Runners:GetPlayers()
  17.  
  18. local title = game.StarterGui.Menu.TitleScreen
  19.  
  20. game.Players.PlayerAdded:Connect(function(player)
  21. local Neutral = game.Teams.Neutral
  22. player.Team = Neutral
  23. end)
  24.  
  25. InRound.Changed:Connect(function()
  26. if InRound.Value == true then
  27. local death = game.Teams.Death -- this sets the teams
  28. local runnersTeam = game.Teams.Runners
  29. local plrs = game.Players
  30. local runners = {}
  31. repeat wait(1) until #plrs:GetPlayers() > 0
  32. local chosen = plrs:GetChildren()[math.random(1, #plrs:GetChildren())]
  33. for i, plr in pairs(plrs:GetChildren()) do
  34. if plr ~= chosen then
  35. table.insert(runners, plr)
  36. plr.Team = runnersTeam
  37. else
  38. plr.Team = death
  39. end
  40. print("teams have been chosen")
  41. end
  42.  
  43. for _, player in pairs(game.Players:GetChildren()) do -- this teleports the players
  44. local char = player.Character
  45. if player.Team == runnersTeam then
  46. char.HumanoidRootPart.CFrame = gamespawn.CFrame
  47. else
  48. char.HumanoidRootPart.CFrame = deathspawn.CFrame
  49. end
  50. end
  51. print("players have teleported to the game area")
  52. else --if the round isn't going, this places everyone in the neutral team and teleports them to the lobby
  53. local plrs = game.Players
  54. local Neutral = game.Teams.Neutral
  55. for i, plr in pairs(plrs:GetChildren()) do
  56. plr.Team = Neutral
  57. end
  58. print("all players have been placed in neutral")
  59. for _, player in pairs(game.Players:GetChildren()) do
  60. local char = player.Character
  61. char.HumanoidRootPart.CFrame = lobbyspawn.CFrame
  62. end
  63. print("players have teleported to the lobby")
  64. end
  65. end)
  66.  
  67. local function RoundTimer() --this is the timer for the rounds. It changes the text in a GUI as well
  68. while wait() do
  69. if won.Value == false then
  70. music:Play()
  71. music1:Stop()
  72. for i = intermissionLength, 0, -1 do
  73. InRound.Value = false
  74. wait(1)
  75. status.Value = "Intermission: ".. i .." seconds left!"
  76. end
  77. music:Stop()
  78. music1:Play()
  79. for i = roundLength, 0, -1 do
  80. InRound.Value = true
  81. if #runnersTable == 0 then
  82. break
  83. end
  84. if won.Value == true then
  85. break
  86. end
  87. wait(1)
  88. status.Value = "Game: ".. i .." seconds left!"
  89. end
  90. local function test()
  91. if #runnersTable ==0 then
  92. status.Value = "Death has destroyed the runners!"
  93. wait(5)
  94. elseif #runnersTable >0 then
  95. status.Value = "The runners have ran out of time!"
  96. wait(5)
  97. end
  98. end
  99. test()
  100. else
  101. music:Stop()
  102. music1:Stop()
  103. music2:Play()
  104. for i = victoryLength, 0, -1 do
  105. wait(1)
  106. status.Value = "The runners have beaten death!"
  107. end
  108.  
  109. for _, player in pairs(game.Players:GetChildren()) do
  110. local char = player.Character
  111. char.HumanoidRootPart.CFrame = lobbyspawn.CFrame
  112. end
  113. won.Value = false
  114. end
  115. end
  116. end
  117.  
  118. spawn(RoundTimer)
Add Comment
Please, Sign In to add comment