Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = game.Players
- local music = {177080835, 209864226, 164147183, 212675193, 181547615}
- local tem = "http://www.roblox.com/asset/?id="
- local needed = 0
- function clearTable(chairs)
- if #chairs >= 1 then
- for k in pairs (chairs) do
- chairs [k] = nil
- end
- end
- end
- function round(num)
- if num >= 0 then return math.floor(num+.5)
- else return math.ceil(num-.5) end
- end
- local function weldBetween(a, b)
- local weld = Instance.new("ManualWeld")
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = CFrame.new()
- weld.C1 = b.CFrame:inverse() * a.CFrame
- weld.Parent = a
- return weld;
- end
- function circle(amount)
- dev = 360/amount
- for i=1, 360, dev do
- local p = game.ServerStorage.Chair:Clone()
- p.Parent = game.Workspace
- p.Handle.CFrame = CFrame.new(-135,3,50)
- * CFrame.Angles(0, math.rad(i), 0)
- * CFrame.new(10,0,0)
- p.Seat.Position = p.Handle.Position
- weldBetween(p.Handle, p.Seat)
- end
- end
- generate = false
- balance = false
- rounds = false
- roundsmore = false
- while true do --main loop
- wait()
- if script.playing.Value == false then -- loop until there is nuff players
- repeat
- hint = Instance.new("Hint")
- hint.Text = "Need " .. needed - players.NumPlayers .. " More Players To Start"
- hint.Parent = game.Workspace
- wait()
- until needed - players.NumPlayers <= 0
- script.playing.Value = true
- hint.Text = "Starting Game...."
- wait(3)
- end
- if script.playing.Value == true then
- --Generate the right amount of chairs for amount of players
- if generate == false then
- generate = true
- hint.Text = "Preparing Map...."
- amount = game.Players.NumPlayers +5
- local dev = 360/amount
- if amount < 0 == false or game.TestService == true then
- circle(amount)
- elseif amount < 0 == true and game.TestService == false then
- hint.Text = "Server Broken D: Sorry. Autokicking..."
- wait(5)
- all = game.Players:GetChildren()
- for i=1, #all do
- all[i]:Kick()
- end
- end
- end
- -- Teleport Every Player
- if balance == false then
- balance = true
- hint.Text = "Balancing Sides...."
- players = game.Players:GetChildren()
- section = #players / 2
- sectionPart = round(section)
- for i=1, sectionPart do
- repeat wait() until players[i].Character
- players[i].Character.Torso.CFrame = CFrame.new(game.Workspace.Area1.Position) + Vector3.new(0, 0, i * 5)
- end
- game.Workspace.blocker1.CanCollide = true
- game.Workspace.blocker2.CanCollide = true
- end
- -- Round 1
- if rounds == false then
- rounds = true
- local rounds = game.Players.NumPlayers
- chairs = {}
- children = game.Workspace:GetChildren()
- for i=1, #children do -- put every chair in workspace into the table chairs
- if children[i].Name == "Chair" then
- table.insert(chairs, children[i])
- end
- end
- hint.Text = "Round 1"
- playTime = math.random(math.random(15,35))
- songId = music[math.random(1, #music)]
- sound = Instance.new("Sound", game.Workspace)
- stop = Instance.new("Sound", game.Workspace)
- stop.SoundId = tem .. 138122923
- sound.Looped = true
- sound.SoundId = tem .. songId
- sound:Play()
- wait(playTime)
- sound:Stop()
- stop:Play()
- hint.Text = "GET TO A CHAIR"
- wait(5)
- hint.Text = "Round Over!"
- safe = {}
- out = {}
- for i=1, #chairs do
- guy = chairs[i].Seat.Sitting
- table.insert(safe, guy.Value)
- end
- for k, v in pairs(game.Players:GetChildren()) do
- kill = true
- for i=1, #safe do
- if safe[i] == v.Name then
- kill = false
- end
- end
- if kill == true then
- v.Character:BreakJoints()
- -- table.insert(out, v.Name)
- end
- end
- -- if #safe == 1 then
- -- --endgame()
- --
- -- else
- -- clearTable(safe)
- -- end
- -- next round (if needed)
- for k, v in pairs(game.Workspace:GetChildren()) do
- if v.Name == "Chair" then v:Destroy() else return end
- end
- local rounds = game.Players.NumPlayers
- clearTable(chairs)
- chairs = {}
- children = game.Workspace:GetChildren()
- for i=1, #children do -- put every chair in workspace into the table chairs
- if children[i].Name == "Chair" then
- table.insert(chairs, children[i])
- end
- end
- hint.Text = "Round 2"
- playTime = math.random(math.random(15,35))
- songId = music[math.random(1, #music)]
- sound = Instance.new("Sound", game.Workspace)
- stop = Instance.new("Sound", game.Workspace)
- stop.SoundId = tem .. 138122923
- sound.Looped = true
- sound.SoundId = tem .. songId
- sound:Play()
- wait(playTime)
- sound:Stop()
- stop:Play()
- hint.Text = "GET TO A CHAIR"
- wait(5)
- hint.Text = "Round Over!"
- safe = {}
- out = {}
- for i=1, #chairs do
- guy = chairs[i].Seat.Sitting
- table.insert(safe, guy.Value)
- end
- for k, v in pairs(game.Players:GetChildren()) do
- kill = true
- for i=1, #safe do
- if safe[i] == v.Name then
- kill = false
- break
- end
- end
- if kill == true then
- v.Character:BreakJoints()
- table.insert(out)
- end
- end
- -- if #safe == 1 then
- -- --endgame()
- --
- -- else
- -- clearTable(safe)
- -- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment