Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(5)
- ---------------------------------------------------------
- --Services
- local Market=game:GetService("MarketplaceService")
- local Badges=game:GetService("BadgeService")
- local Http=game:GetService("HttpService")
- local Run=game:GetService("RunService")
- --Variables
- --Don't change these
- local CurrentMap=nil
- --Change at will
- local InGameTime=70 -- +10 for every kill
- local Intermission=30
- local MinPlayers=4
- local VoteTime=20
- ---------------------------------------------------------
- local MapImages={}
- function StartVote(Map1,Map2,Map3)
- local UI=script.VoteUI
- for i,v in pairs(game.Players:GetChildren()) do
- local Gui=UI:Clone()
- Gui.Parent=v.PlayerGui
- local M1=Gui.Frame.Map1
- local M2=Gui.Frame.Map2
- local M3=Gui.Frame.Map3
- local Map1Img=MapImages[Map1.Name]
- local Map2Img=MapImages[Map2.Name]
- local Map3Img=MapImages[Map3.Name]
- --M1.Button.Image=Map1Img
- --M2.Button.Image=Map2Img
- --M3.Button.Image=Map3Img
- M1.Title.Text=Map1.Name
- M2.Title.Text=Map2.Name
- M3.Title.Text=Map3.Name
- coroutine.wrap(function()
- while wait() do
- M1.Votes.Text=script.Votes.Map1.Value
- M2.Votes.Text=script.Votes.Map2.Value
- M3.Votes.Text=script.Votes.Map3.Value
- end
- end)()
- M1.Button.MouseButton1Down:connect(function()
- local CurVote=Gui.CurrentVote
- local Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value-1
- end
- CurVote.Value="Map1"
- Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value+1
- end
- end)
- M2.Button.MouseButton1Down:connect(function()
- local CurVote=Gui.CurrentVote
- local Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value-1
- end
- CurVote.Value="Map2"
- Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value+1
- end
- end)
- M3.Button.MouseButton1Down:connect(function()
- local CurVote=Gui.CurrentVote
- local Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value-1
- end
- CurVote.Value="Map3"
- Obj=script.Votes:FindFirstChild(CurVote.Value)
- if Obj then
- Obj.Value=Obj.Value+1
- end
- end)
- coroutine.wrap(function()
- for i=VoteTime,0,-1 do
- Gui.Frame.Timer.Text=i
- wait(1)
- end
- Gui:destroy()
- end)
- end
- wait(VoteTime)
- local Table={script.Votes.Map1,script.Votes.Map2,script.Votes.Map3}
- local Current=nil
- for i,v in pairs(Table) do
- if Current then
- if v.Value>Current.Value then
- Current=v
- elseif v.Value==Current.Value then
- local Tab={v,Current}
- Current=Tab[math.random(1,#Tab)]
- end
- elseif not Current then
- Current=v
- end
- end
- return Current
- end
- function GetMaps()
- local Maps=game.ReplicatedStorage.Maps:GetChildren()
- local Num=math.random(1,#Maps)
- local Map1=Maps[Num]
- table.remove(Maps,Num)
- Num=math.random(1,#Maps)
- local Map2=Maps[Num]
- table.remove(Maps,Num)
- Num=math.random(1,#Maps)
- local Map3=Maps[Num]
- table.remove(Maps,Num)
- StartVote(Map1,Map2,Map3)
- end
- function GetPlayers()
- local Players=game.Players:GetChildren()
- local b=math.random(1,#Players)
- local B=Players[b]
- table.remove(Players,b)
- local j=math.random(1,#Players)
- local J=Players[j]
- table.remove(Players,j)
- return {Joker=J,Batman=B,Regular=Players}
- end
- function EndGame(Map)
- for i,v in pairs(Map:GetChildren()) do
- v:destroy()
- wait()
- end
- Map:destroy()
- end
- function Msg(String)
- script.Notification.Value=String
- end
- function NewGame()
- local Players=GetPlayers()
- local iTime=Intermission
- local gTime=InGameTime
- for i=iTime,0,-1 do
- Msg("New game beginning in "..iTime.." seconds")
- wait(1)
- end
- local Map=GetMaps()
- repeat wait() until Map~=nil
- --[[local Map=GetMap()
- local Players=GetPlayers()
- local iTime=Intermission
- local gTime=InGameTime
- repeat
- iTime=iTime-1
- until iTime<=0
- for i,v in pairs(Players.Regular) do
- v.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
- v.Character.Humanoid.Died:connect(function()
- table.remove(Players.Regular,i)
- end)
- end
- Players.Batman.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
- Players.Batman.Character.Humanoid.Died:connect(function()
- Players.Batman=nil
- end)
- Players.Joker.Character:MoveTo(Map.Spawns:GetChildren()[math.random(1,#Map.Spawns:GetChildren())].Position)
- Players.Joker.Character.Humanoid.Died:connect(function()
- Players.Joker=nil
- end)
- local Knife=game.ReplicatedStorage.Tools.Knife
- local Gun=game.ReplicatedStorage.Tools.Gun
- Gun:Clone().Parent=Players.Batman.Backpack
- Knife:Clone().Parent=Players.Joker.Backpack
- repeat
- gTime=gTime-1
- if not Players.Batman or not Players.Joker or #Players.Regular<=1 then
- gTime=0
- end
- wait(1)
- until gTime<=0
- EndGame(Map)
- NewGame()]]
- end
- NewGame()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement