Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- playersremaining = {}
- playersplayed = {}
- playersnotplayed = {}
- playersfighting = {}
- mapchosen = ""
- round = 1
- duel = 1
- maps = {"Bastion", "Bricktops", "Narrowgill", "Pitgrounds", "Stonebrick", "Temple", "Crown"}
- function won(winner, loser)
- for i,v in pairs(playersremaining) do
- if v == player.Name then
- table.remove(loser)
- end
- end
- for i,v in pairs(playersplayed) do
- if v == player.Name then
- table.remove(loser)
- end
- end
- for i,v in pairs(playersfighting) do
- if v == player.Name then
- table.remove(loser)
- table.remove(winner)
- end
- end
- for i,v in pairs(playersnotplayed) do
- if v == player.Name then
- table.remove(loser)
- end
- end
- end
- game.Players.PlayerRemoving:connect(function(player)
- wait(.001)
- for i,v in pairs(playersremaining) do
- if v == player.Name then
- table.remove(v)
- end
- end
- for i,v in pairs(playersplayed) do
- if v == player.Name then
- table.remove(v)
- end
- end
- for i,v in pairs(playersfighting) do
- if v == player.Name then
- table.remove(v)
- for m,n in pairs(playersfighting) do
- game.Players["" ..n.. ""].Win.Value = true
- end
- end
- end
- for i,v in pairs(playersnotplayed) do
- if v == player.Name then
- table.remove(v)
- end
- end
- end)
- while true do
- h = Instance.new("Hint", game.Workspace)
- while #game.Players:GetChildren() < 4 do
- h.Text = "Waiting for 4 players."
- wait(.3)
- h.Text = "Waiting for 4 players.."
- wait(.3)
- h.Text = "Waiting for 4 players..."
- wait(.3)
- end
- h:Destroy()
- for i,v in pairs(game.Players:GetChildren()) do
- table.insert(remainingplayers, v.Name)
- end
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "Welcome to RCL Tournament!"
- end
- wait(4)
- for i,v in pairs(game.Players:GetChildren()) do
- v.PlayerGui:findFirstChild("MessageGui"):Destroy()
- end
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "There are " ..#game.Players:GetChildren().. " players in this tournament."
- end
- wait(4)
- for i,v in pairs(game.Players:GetChildren()) do
- v.PlayerGui:findFirstChild("MessageGui"):Destroy()
- end
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "Picking random map..."
- end
- wait(6)
- for i,v in pairs(game.Players:GetChildren()) do
- v.PlayerGui:findFirstChild("MessageGui"):Destroy()
- end
- mapchosen = maps[math.random(1, #maps)]
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "The map [" ..string.upper(mapchosen).. "] has been chosen."
- end
- game.Lighting["" ..mapchosen.. ""]:Clone().Parent = game.Workspace
- wait(5)
- for i,v in pairs(game.Players:GetChildren()) do
- v.PlayerGui:findFirstChild("MessageGui"):Destroy()
- end
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "Changing Lighting settings for optimal gameplay..."
- end
- if mapchosen == "Bricktops" then
- game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = true
- game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- elseif mapchosen == "Narrowgill" then
- game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = true
- game.Lighting.ShadowColor = Color3.new(178/255,178/255,183/255)
- game.Lighting.TimeOfDay = "08:52:55"
- game.Lighting.FogColor = Color3.new(185/255,185/255,185/255)
- game.Lighting.FogEnd = 800
- game.Lighting.FogStart = 300
- elseif mapchosen == "Pitgrounds" then
- game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = true
- game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- elseif mapchosen == "Stonebrick" then
- game.Lighting.Ambient = Color3.new(128/255,128/255,128/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = true
- game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- elseif mapchosen == "Bastion" then
- game.Lighting.Ambient = Color3.new(127/255,127/255,127/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = false
- game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- elseif mapchosen == "Temple" then
- game.Lighting.Ambient = Color3.new(123/255,123/255,123/255)
- game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
- game.Lighting.Outlines = false
- game.Lighting.ShadowColor = Color3.new(179/255,179/255,184/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- elseif mapchosen == "Crown" then
- game.Lighting.Ambient = Color3.new(113/255,113/255,113/255)
- game.Lighting.OutdoorAmbient = Color3.new(127/255,127/255,127/255)
- game.Lighting.Outlines = false
- game.Lighting.ShadowColor = Color3.new(178/255,178/255,183/255)
- game.Lighting.TimeOfDay = "14:00:00"
- game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
- game.Lighting.FogEnd = 100000
- game.Lighting.FogStart = 0
- end
- wait(7)
- for i,v in pairs(game.Players:GetChildren()) do
- v.PlayerGui:findFirstChild("MessageGui"):Destroy()
- end
- for i,v in pairs(game.Players:GetChildren()) do
- if v.Playing.Value == true then
- table.insert(remainingplayers, v.Name)
- table.insert(playersnotplayed, v.Name)
- end
- end
- h = Instance.new("Hint", game.Workspace)
- while #playersremaining >= 2 do
- while #playersnotplayed >= 2 do
- randomplayer1 = playersnotplayed[math.random(1, #playersnotplayed)]
- table.remove(playersnotplayed, randomplayer1)
- randomplayer2 = playersnotplayed[math.random(1, #playersnotplayed)]
- table.remove(playersnotplayed, randomplayer2)
- table.insert(playersplayed, randomplayer1)
- table.insert(playersplayed, randomplayer2)
- table.insert(playersfighting, randomplayer1)
- table.insert(playersfighting, randomplayer2)
- h.Text = "[ROUND_" ..round.. "] [DUEL_" ..duel.. "] " ..randomplayer1.. " VS. " ..randomplayer2.. ""
- for i,v in pairs(playersfighting) do
- game.Players["" ..v.. ""].Character.Humanoid.Died:connect(function()
- wait(.001)
- for m,n in pairs(playersfighting) do
- won(n, v)
- end
- duel = duel + 1
- end)
- end
- end
- if #playersremaining == 1 then
- for i,v in pairs(game.Players:GetChildren()) do
- gui = game.Lighting.MessageGui:Clone()
- gui.Parent = v.PlayerGui
- gui.Frame.TextButton.MessageText.Value = "" ..playersremaining[1].. " has won the tournament!"
- end
- break --I want these to break the loops at lines 193 and 194. They error for some reason.
- break
- end
- if #playersnotplayed == 1 then
- h.Text = "" ..playersnotplayed[1].. " gets a bye."
- table.remove(playersnotplayed[1])
- wait(3)
- end
- for i,v in pairs(playersplayed) do
- table.remove(v)
- end
- round = round + 1
- duel = duel + 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement