Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.91 KB | None | 0 0
  1. wait(5)
  2. ---------------------------------------------------------
  3.     --Services
  4.         local Market=game:GetService("MarketplaceService")
  5.         local Badges=game:GetService("BadgeService")
  6.         local Http=game:GetService("HttpService")
  7.         local Run=game:GetService("RunService")
  8.     --Variables
  9.         --Don't change these
  10.             local CurrentMap=nil
  11.         --Change at will
  12.             local InGameTime=70 -- +10 for every kill
  13.             local Intermission=30
  14.             local MinPlayers=4
  15.             local VoteTime=20
  16. ---------------------------------------------------------
  17. local MapImages={}
  18. function StartVote(Map1,Map2,Map3)
  19.     local UI=script.VoteUI
  20.     for i,v in pairs(game.Players:GetChildren()) do
  21.         local Gui=UI:Clone()
  22.         Gui.Parent=v.PlayerGui
  23.         local M1=Gui.Frame.Map1
  24.         local M2=Gui.Frame.Map2
  25.         local M3=Gui.Frame.Map3
  26.        
  27.         local Map1Img=MapImages[Map1.Name]
  28.         local Map2Img=MapImages[Map2.Name]
  29.         local Map3Img=MapImages[Map3.Name]
  30.        
  31.         --M1.Button.Image=Map1Img
  32.         --M2.Button.Image=Map2Img
  33.         --M3.Button.Image=Map3Img
  34.        
  35.         M1.Title.Text=Map1.Name
  36.         M2.Title.Text=Map2.Name
  37.         M3.Title.Text=Map3.Name
  38.        
  39.         coroutine.wrap(function()
  40.             while wait() do
  41.                 M1.Votes.Text=script.Votes.Map1.Value
  42.                 M2.Votes.Text=script.Votes.Map2.Value
  43.                 M3.Votes.Text=script.Votes.Map3.Value
  44.             end
  45.         end)()
  46.        
  47.         M1.Button.MouseButton1Down:connect(function()
  48.             local CurVote=Gui.CurrentVote
  49.             local Obj=script.Votes:FindFirstChild(CurVote.Value)
  50.             if Obj then
  51.                 Obj.Value=Obj.Value-1
  52.             end
  53.            
  54.             CurVote.Value="Map1"
  55.             Obj=script.Votes:FindFirstChild(CurVote.Value)
  56.             if Obj then
  57.                 Obj.Value=Obj.Value+1
  58.             end
  59.         end)
  60.         M2.Button.MouseButton1Down:connect(function()
  61.             local CurVote=Gui.CurrentVote
  62.             local Obj=script.Votes:FindFirstChild(CurVote.Value)
  63.             if Obj then
  64.                 Obj.Value=Obj.Value-1
  65.             end
  66.             CurVote.Value="Map2"
  67.             Obj=script.Votes:FindFirstChild(CurVote.Value)
  68.             if Obj then
  69.                 Obj.Value=Obj.Value+1
  70.             end
  71.         end)
  72.         M3.Button.MouseButton1Down:connect(function()
  73.             local CurVote=Gui.CurrentVote
  74.             local Obj=script.Votes:FindFirstChild(CurVote.Value)
  75.             if Obj then
  76.                 Obj.Value=Obj.Value-1
  77.             end
  78.             CurVote.Value="Map3"
  79.             Obj=script.Votes:FindFirstChild(CurVote.Value)
  80.             if Obj then
  81.                 Obj.Value=Obj.Value+1
  82.             end
  83.         end)
  84.        
  85.         coroutine.wrap(function()
  86.             for i=VoteTime,0,-1 do
  87.                 Gui.Frame.Timer.Text=i
  88.                 wait(1)
  89.             end
  90.             Gui:destroy()
  91.         end)
  92.     end
  93.     wait(VoteTime)
  94.     local Table={script.Votes.Map1,script.Votes.Map2,script.Votes.Map3}
  95.     local Current=nil
  96.     for i,v in pairs(Table) do
  97.         if Current then
  98.             if v.Value>Current.Value then
  99.                 Current=v
  100.             elseif v.Value==Current.Value then
  101.                 local Tab={v,Current}
  102.                 Current=Tab[math.random(1,#Tab)]
  103.             end
  104.         elseif not Current then
  105.             Current=v
  106.         end
  107.     end
  108.     return Current
  109. end
  110.  
  111. function GetMaps()
  112.     local Maps=game.ReplicatedStorage.Maps:GetChildren()
  113.     local Num=math.random(1,#Maps)
  114.     local Map1=Maps[Num]
  115.     table.remove(Maps,Num)
  116.     Num=math.random(1,#Maps)
  117.     local Map2=Maps[Num]
  118.     table.remove(Maps,Num)
  119.     Num=math.random(1,#Maps)
  120.     local Map3=Maps[Num]
  121.     table.remove(Maps,Num)
  122.     StartVote(Map1,Map2,Map3)
  123. end
  124.  
  125. function GetPlayers()
  126.     local Players=game.Players:GetChildren()
  127.     local b=math.random(1,#Players)
  128.     local B=Players[b]
  129.     table.remove(Players,b)
  130.     local j=math.random(1,#Players)
  131.     local J=Players[j]
  132.     table.remove(Players,j)
  133.     return {Joker=J,Batman=B,Regular=Players}
  134. end
  135.  
  136. function EndGame(Map)
  137.     for i,v in pairs(Map:GetChildren()) do
  138.         v:destroy()
  139.         wait()
  140.     end
  141.     Map:destroy()
  142. end
  143.  
  144. function Msg(String)
  145.     script.Notification.Value=String
  146. end
  147.  
  148. function NewGame()
  149.     local Players=GetPlayers()
  150.     local iTime=Intermission
  151.     local gTime=InGameTime
  152.    
  153.     for i=iTime,0,-1 do
  154.         Msg("New game beginning in "..iTime.." seconds")
  155.         wait(1)
  156.     end
  157.    
  158.     local Map=GetMaps()
  159.     repeat wait() until Map~=nil
  160.    
  161.    
  162.     --[[local Map=GetMap()
  163.     local Players=GetPlayers()
  164.     local iTime=Intermission
  165.     local gTime=InGameTime
  166.     repeat
  167.         iTime=iTime-1
  168.     until iTime<=0
  169.     for i,v in pairs(Players.Regular) do
  170.         v.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
  171.         v.Character.Humanoid.Died:connect(function()
  172.             table.remove(Players.Regular,i)
  173.         end)
  174.     end
  175.     Players.Batman.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
  176.     Players.Batman.Character.Humanoid.Died:connect(function()
  177.         Players.Batman=nil
  178.     end)
  179.     Players.Joker.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
  180.     Players.Joker.Character.Humanoid.Died:connect(function()
  181.         Players.Joker=nil
  182.     end)
  183.     local Knife=game.ReplicatedStorage.Tools.Knife
  184.     local Gun=game.ReplicatedStorage.Tools.Gun
  185.     Gun:Clone().Parent=Players.Batman.Backpack
  186.     Knife:Clone().Parent=Players.Joker.Backpack
  187.     repeat
  188.         gTime=gTime-1
  189.         if not Players.Batman or not Players.Joker or #Players.Regular<=1 then
  190.             gTime=0
  191.         end
  192.         wait(1)
  193.     until gTime<=0
  194.     EndGame(Map)
  195.     NewGame()]]
  196. end
  197. NewGame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement