ForeverDev

Untitled

Oct 18th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. local roundTime = 180
  2.  
  3. local spawns = {
  4.     Map1 = {
  5.         {Vector3.new(0, 50, 0), true},
  6.         {Vector3.new(0, 0, 50), true}
  7.     }
  8. }
  9.  
  10. function getPlayers(callback, returnRandomPlayer)
  11.     local players = game.Players:GetPlayers()
  12.     if returnRandomPlayer then
  13.         return players[math.random(#players)]
  14.     end
  15.     for i, v in pairs(players) do
  16.         callback(v)
  17.     end
  18. end
  19. function giveTool(player, tool)
  20.     local clone = tool:clone();
  21.     clone.Parent = player.Backpack;
  22. end
  23. function message(bg, color, tran, text, Time)
  24.     local xbg = Color3.new(unpack(bg));
  25.     local xcolor = Color3.new(unpack(color));
  26.     coroutine.wrap(function()
  27.         getPlayers(function(plyr)
  28.             local GUI = plyr.PlayerGui.MessageGUI
  29.             GUI.Frame.Visible = true;
  30.             GUI.Frame.TextLabel.Text = text;
  31.             GUI.Frame.BackgroundColor3 = xbg;
  32.             GUI.Frame.TextLabel.TextColor3 = xcolor;
  33.             GUI.Frame.BackgroundTransparency = tran;
  34.             GUI.Frame.TextLabel.BackgroundTransparency = tran;
  35.         end)
  36.         wait(Time)
  37.         getPlayers(function(plyr)
  38.             local GUI = plyr.PlayerGui.MessageGUI.Frame;
  39.             GUI:Destroy()
  40.         end)
  41.     end)()
  42. end
  43. function chooseMap()
  44.     for _, object in ipairs(Workspace:GetChildren()) do
  45.         if object.Name:match("Map") then
  46.             object:Destroy()
  47.         end
  48.     end
  49.     local maps = game.ServerStorage.Maps:GetChildren()
  50.     local map = maps[math.random(#maps)]:clone()
  51.     local cloneOfSpawns = spawns
  52.     local teleport = cloneOfSpawns[map.Name]
  53.     map.Parent = Workspace
  54.     map:MakeJoints()
  55.     getPlayers(function(player)
  56.         local place;
  57.         repeat
  58.             place = teleport[math.random(#teleport)]
  59.         until place[2]
  60.         place[2] = false
  61.         player.Character:MoveTo(place[1])
  62.     end)
  63. end
  64.  
  65. while wait() do
  66.     for i = 10, 1, -1 do
  67.         print("Intermission: " .. i)
  68.         wait(1)
  69.     end
  70.     chooseMap()
  71.     for i = roundTime, 1, -1 do
  72.         print("Time: " .. i)
  73.         wait(1)
  74.     end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment