Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. local rps = game:GetService("ReplicatedStorage")
  2. local status = rps:WaitForChild("infovalue")
  3. local mapstorage = game.Workspace:WaitForChild("mapstorage")
  4. local gamemode = nil
  5.  
  6. intermission = "rbxassetid://317061358"
  7.  
  8. playing = {}
  9.  
  10. victorysongs = {
  11. "rbxassetid://191907895",
  12. "rbxassetid://236626093",
  13. "rbxassetid://239902092",
  14. "rbxassetid://155722789",
  15. "rbxassetid://144208923",
  16. "rbxassetid://622483436"
  17. }
  18.  
  19. gamemodes = {
  20. "team destruction",
  21. }
  22.  
  23. while true do --main game loop
  24. --[[while game.Players.NumPlayers < 2 do
  25. status.Value = "There needs to be " .. 2 - game.Players.NumPlayers .. " more players to begin"
  26. repeat wait(1) until game.Players.NumPlayers > 2
  27. end--]]--
  28.  
  29. for i = 45,0,-1 do
  30. status.Value = "Intermission ".. i
  31. wait(1)
  32. end
  33.  
  34. --choosing random maps
  35. local miss = game:GetService("ServerStorage").maps:GetChildren()
  36. local choosemapa = math.random(1,#miss)
  37. local chosenmapa = miss[choosemapa]
  38. table.remove(miss,choosemapa)
  39. rps.mapchoose.mapa.mapname.Value = chosenmapa.Name
  40. local choosemapb = math.random(1,#miss)
  41. local chosenmapb = miss[choosemapb]
  42. table.remove(miss,choosemapb)
  43. rps.mapchoose.mapb.mapname.Value = chosenmapb.Name
  44.  
  45. --puting up voting gui
  46. status.Value = "Voting for map..."
  47. for _,player in pairs (game.Players:GetPlayers()) do
  48. if player.playing.Value then
  49. player.PlayerGui.maps.mainframe.Visible = true
  50. end
  51. end
  52. wait(10)
  53.  
  54. --finding out the highest voted map
  55. local maps = rps.mapchoose:GetChildren()
  56. table.sort(maps,function(a,b)
  57. return a.Value > b.Value
  58. end)
  59.  
  60. local highestValue = maps[1]
  61. local chosenmap = game:GetService("ServerStorage").maps:FindFirstChild(highestValue.mapname.Value)
  62. rps.mapchoose.mapa.Value = 0
  63. rps.mapchoose.mapb.Value = 0
  64.  
  65. --[[if chosenmap == "destructionrun" then
  66. workspace.gamemode.Value = "Destruction run"
  67. else
  68. local rndmode = math.random(1,#gamemodes)
  69. rndmode = gamemodes[rndmode]
  70. workspace.gamemode.Value = rndmode
  71. end]]--
  72.  
  73. chosenmap:Clone().Parent = mapstorage
  74.  
  75. wait(2)
  76.  
  77. status.Value = "loading game"
  78. local spawns = chosenmap:WaitForChild("spawns"):GetChildren()
  79. for _,player in pairs(game.Players:GetPlayers()) do
  80. if player and #spawns >0 then
  81. if player.playing.Value then
  82. local allspawns = math.random(1,#spawns)
  83. local rndspawn = spawns[allspawns]
  84. if rndspawn and player then
  85. table.remove(spawns,allspawns)
  86. player.Character:MoveTo(rndspawn.Position)
  87. player.PlayerGui.maps.mainframe.Visible = false
  88. table.insert(playing,player)
  89. end
  90. player.Character.Humanoid.WalkSpeed = 0
  91. player.Character.Humanoid.JumpPower = 0
  92. player.PlayerGui.gameplaygui.main.gameplayfunctions.Disabled = false
  93. player.PlayerGui.menu.mainframe.Visible = false
  94. if player.PlayerGui:FindFirstChild("intermissionmusic") then
  95. player.PlayerGui.intermissionmusic:Destroy()
  96. end
  97. end
  98. end
  99. end
  100.  
  101. wait(5)
  102. local lobbyspawns = workspace.lobby.lobbyspawns:GetChildren()
  103.  
  104. for i = 60,0,-1 do
  105. status.Value = "game " .. i
  106. if i == 0 or game.ServerStorage.Winner.Value ~= "false" then
  107. status.Value = "Times up!"
  108. for _,player in pairs(game.Players:GetPlayers()) do
  109. local victorysong = math.random(1,#victorysongs)
  110. local song = victorysongs[victorysong]
  111. if player.PlayerGui:FindFirstChild("Song")then player.PlayerGui:FindFirstChild("Song"):Destroy() end
  112. local sound = Instance.new("Sound",player.PlayerGui)
  113. sound.SoundId = song
  114. sound.Name = "Song"
  115. sound:play()
  116. player.PlayerGui.awardgui.mainframe.main.awardhandling.Disabled = false
  117. player.Character.Humanoid.WalkSpeed = 16
  118. player.Character.Humanoid.JumpPower = 50
  119. if player.PlayerGui:FindFirstChild("intermissionmusic") then
  120. player.PlayerGui.intermissionmusic:Destroy()
  121. end
  122. local rndspawn = lobbyspawns[math.random(1,#lobbyspawns)]
  123. player.Character:MoveTo(rndspawn.Position)
  124. player.PlayerGui.menu.mainframe.Visible = true
  125. end
  126. break
  127. else
  128. end
  129. wait(1)
  130. end
  131. mapstorage:ClearAllChildren()
  132. wait(8)
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement