Advertisement
Guest User

Script

a guest
May 8th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.05 KB | None | 0 0
  1. playersremaining = {}
  2. playersplayed = {}
  3. playersnotplayed = {}
  4. playersfighting = {}
  5. mapchosen = ""
  6. round = 1
  7. duel = 1
  8. maps = {"Bastion", "Bricktops", "Narrowgill", "Pitgrounds", "Stonebrick", "Temple", "Crown"}
  9.  
  10. function won(winner, loser)
  11.     for i,v in pairs(playersremaining) do
  12.         if v == player.Name then
  13.             table.remove(loser)
  14.         end
  15.     end
  16.     for i,v in pairs(playersplayed) do
  17.         if v == player.Name then
  18.             table.remove(loser)
  19.         end
  20.     end
  21.     for i,v in pairs(playersfighting) do
  22.         if v == player.Name then
  23.             table.remove(loser)
  24.             table.remove(winner)
  25.         end
  26.     end
  27.     for i,v in pairs(playersnotplayed) do
  28.         if v == player.Name then
  29.             table.remove(loser)
  30.         end
  31.     end
  32. end
  33.  
  34. game.Players.PlayerRemoving:connect(function(player)
  35.     wait(.001)
  36.     for i,v in pairs(playersremaining) do
  37.         if v == player.Name then
  38.             table.remove(v)
  39.         end
  40.     end
  41.     for i,v in pairs(playersplayed) do
  42.         if v == player.Name then
  43.             table.remove(v)
  44.         end
  45.     end
  46.     for i,v in pairs(playersfighting) do
  47.         if v == player.Name then
  48.             table.remove(v)
  49.             for m,n in pairs(playersfighting) do
  50.                 game.Players["" ..n.. ""].Win.Value = true
  51.             end
  52.         end
  53.     end
  54.     for i,v in pairs(playersnotplayed) do
  55.         if v == player.Name then
  56.             table.remove(v)
  57.         end
  58.     end
  59. end)
  60.  
  61. while true do
  62.     h = Instance.new("Hint", game.Workspace)
  63.     while #game.Players:GetChildren() < 4 do
  64.         h.Text = "Waiting for 4 players."
  65.         wait(.3)
  66.         h.Text = "Waiting for 4 players.."
  67.         wait(.3)
  68.         h.Text = "Waiting for 4 players..."
  69.         wait(.3)
  70.     end
  71.     h:Destroy()
  72.     for i,v in pairs(game.Players:GetChildren()) do
  73.         table.insert(remainingplayers, v.Name)
  74.     end
  75.     for i,v in pairs(game.Players:GetChildren()) do
  76.         gui = game.Lighting.MessageGui:Clone()
  77.         gui.Parent = v.PlayerGui
  78.         gui.Frame.TextButton.MessageText.Value = "Welcome to RCL Tournament!"
  79.     end
  80.     wait(4)
  81.     for i,v in pairs(game.Players:GetChildren()) do
  82.         v.PlayerGui:findFirstChild("MessageGui"):Destroy()
  83.     end
  84.     for i,v in pairs(game.Players:GetChildren()) do
  85.         gui = game.Lighting.MessageGui:Clone()
  86.         gui.Parent = v.PlayerGui
  87.         gui.Frame.TextButton.MessageText.Value = "There are " ..#game.Players:GetChildren().. " players in this tournament."
  88.     end
  89.     wait(4)
  90.     for i,v in pairs(game.Players:GetChildren()) do
  91.         v.PlayerGui:findFirstChild("MessageGui"):Destroy()
  92.     end
  93.     for i,v in pairs(game.Players:GetChildren()) do
  94.         gui = game.Lighting.MessageGui:Clone()
  95.         gui.Parent = v.PlayerGui
  96.         gui.Frame.TextButton.MessageText.Value = "Picking random map..."
  97.     end
  98.     wait(6)
  99.     for i,v in pairs(game.Players:GetChildren()) do
  100.         v.PlayerGui:findFirstChild("MessageGui"):Destroy()
  101.     end
  102.     mapchosen = maps[math.random(1, #maps)]
  103.     for i,v in pairs(game.Players:GetChildren()) do
  104.         gui = game.Lighting.MessageGui:Clone()
  105.         gui.Parent = v.PlayerGui
  106.         gui.Frame.TextButton.MessageText.Value = "The map [" ..string.upper(mapchosen).. "] has been chosen."
  107.     end
  108.     game.Lighting["" ..mapchosen.. ""]:Clone().Parent = game.Workspace
  109.     wait(5)
  110.     for i,v in pairs(game.Players:GetChildren()) do
  111.         v.PlayerGui:findFirstChild("MessageGui"):Destroy()
  112.     end
  113.     for i,v in pairs(game.Players:GetChildren()) do
  114.         gui = game.Lighting.MessageGui:Clone()
  115.         gui.Parent = v.PlayerGui
  116.         gui.Frame.TextButton.MessageText.Value = "Changing Lighting settings for optimal gameplay..."
  117.     end
  118.     if mapchosen == "Bricktops" then
  119.         game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
  120.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  121.         game.Lighting.Outlines = true
  122.         game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
  123.         game.Lighting.TimeOfDay = "14:00:00"
  124.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  125.         game.Lighting.FogEnd = 100000
  126.         game.Lighting.FogStart = 0
  127.     elseif mapchosen == "Narrowgill" then
  128.         game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
  129.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  130.         game.Lighting.Outlines = true
  131.         game.Lighting.ShadowColor = Color3.new(178/255,178/255,183/255)
  132.         game.Lighting.TimeOfDay = "08:52:55"
  133.         game.Lighting.FogColor = Color3.new(185/255,185/255,185/255)
  134.         game.Lighting.FogEnd = 800
  135.         game.Lighting.FogStart = 300
  136.     elseif mapchosen == "Pitgrounds" then
  137.         game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
  138.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  139.         game.Lighting.Outlines = true
  140.         game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
  141.         game.Lighting.TimeOfDay = "14:00:00"
  142.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  143.         game.Lighting.FogEnd = 100000
  144.         game.Lighting.FogStart = 0
  145.     elseif mapchosen == "Stonebrick" then
  146.         game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
  147.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  148.         game.Lighting.Outlines = true
  149.         game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
  150.         game.Lighting.TimeOfDay = "14:00:00"
  151.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  152.         game.Lighting.FogEnd = 100000
  153.         game.Lighting.FogStart = 0
  154.     elseif mapchosen == "Bastion" then
  155.         game.Lighting.Ambient = Color3.new(127/255,127/255,127/255)
  156.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  157.         game.Lighting.Outlines = false
  158.         game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
  159.         game.Lighting.TimeOfDay = "14:00:00"
  160.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  161.         game.Lighting.FogEnd = 100000
  162.         game.Lighting.FogStart = 0
  163.     elseif mapchosen == "Temple" then
  164.         game.Lighting.Ambient = Color3.new(123/255,123/255,123/255)
  165.         game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
  166.         game.Lighting.Outlines = false
  167.         game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
  168.         game.Lighting.TimeOfDay = "14:00:00"
  169.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  170.         game.Lighting.FogEnd = 100000
  171.         game.Lighting.FogStart = 0
  172.     elseif mapchosen == "Crown" then
  173.         game.Lighting.Ambient = Color3.new(113/255,113/255,113/255)
  174.         game.Lighting.OutdoorAmbient = Color3.new(127/255,127/255,127/255)
  175.         game.Lighting.Outlines = false
  176.         game.Lighting.ShadowColor = Color3.new(178/255,178/255,183/255)
  177.         game.Lighting.TimeOfDay = "14:00:00"
  178.         game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
  179.         game.Lighting.FogEnd = 100000
  180.         game.Lighting.FogStart = 0
  181.     end
  182.     wait(7)
  183.     for i,v in pairs(game.Players:GetChildren()) do
  184.         v.PlayerGui:findFirstChild("MessageGui"):Destroy()
  185.     end
  186.     for i,v in pairs(game.Players:GetChildren()) do
  187.         if v.Playing.Value == true then
  188.             table.insert(remainingplayers, v.Name)
  189.             table.insert(playersnotplayed, v.Name)
  190.         end
  191.     end
  192.     h = Instance.new("Hint", game.Workspace)
  193.     while #playersremaining >= 2 do
  194.         while #playersnotplayed >= 2 do
  195.             randomplayer1 = playersnotplayed[math.random(1, #playersnotplayed)]
  196.             table.remove(playersnotplayed, randomplayer1)
  197.             randomplayer2 = playersnotplayed[math.random(1, #playersnotplayed)]
  198.             table.remove(playersnotplayed, randomplayer2)
  199.             table.insert(playersplayed, randomplayer1)
  200.             table.insert(playersplayed, randomplayer2)
  201.             table.insert(playersfighting, randomplayer1)
  202.             table.insert(playersfighting, randomplayer2)
  203.             h.Text = "[ROUND_" ..round.. "] [DUEL_" ..duel.. "] " ..randomplayer1.. " VS. " ..randomplayer2.. ""
  204.             for i,v in pairs(playersfighting) do
  205.                 game.Players["" ..v.. ""].Character.Humanoid.Died:connect(function()
  206.                     wait(.001)
  207.                     for m,n in pairs(playersfighting) do
  208.                         won(n, v)
  209.                     end
  210.                     duel = duel + 1
  211.                 end)
  212.             end
  213.         end
  214.         if #playersremaining == 1 then
  215.             for i,v in pairs(game.Players:GetChildren()) do
  216.                 gui = game.Lighting.MessageGui:Clone()
  217.                 gui.Parent = v.PlayerGui
  218.                 gui.Frame.TextButton.MessageText.Value = "" ..playersremaining[1].. " has won the tournament!"
  219.             end
  220.             break --I want these to break the loops at lines 193 and 194. They error for some reason.
  221.             break
  222.         end
  223.         if #playersnotplayed == 1 then
  224.             h.Text = "" ..playersnotplayed[1].. " gets a bye."
  225.             table.remove(playersnotplayed[1])
  226.             wait(3)
  227.         end
  228.         for i,v in pairs(playersplayed) do
  229.             table.remove(v)
  230.         end
  231.         round = round + 1
  232.         duel = duel + 1
  233.     end
  234. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement