Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local roundLength = 60
- local intermissionLength = 10
- local victoryLength = 15
- local InRound = game.ReplicatedStorage.InRound
- local lobbyspawn = game.Workspace.LobbyAreaSpawn
- local gamespawn = game.Workspace.GameAreaSpawn
- local deathspawn = game.Workspace.deathspawn
- local status = game.ReplicatedStorage.Status
- local won = game.ReplicatedStorage.Won
- local music = game.Workspace.music
- local music1 = game.Workspace.music_duplex
- local music2 = game.Workspace.music_duplexwon
- local trombone = game.Workspace.trombone
- local runnersTable = game.Teams.Runners:GetPlayers()
- local title = game.StarterGui.Menu.TitleScreen
- game.Players.PlayerAdded:Connect(function(player)
- local Neutral = game.Teams.Neutral
- player.Team = Neutral
- end)
- InRound.Changed:Connect(function()
- if InRound.Value == true then
- local death = game.Teams.Death -- this sets the teams
- local runnersTeam = game.Teams.Runners
- local plrs = game.Players
- local runners = {}
- repeat wait(1) until #plrs:GetPlayers() > 0
- local chosen = plrs:GetChildren()[math.random(1, #plrs:GetChildren())]
- for i, plr in pairs(plrs:GetChildren()) do
- if plr ~= chosen then
- table.insert(runners, plr)
- plr.Team = runnersTeam
- else
- plr.Team = death
- end
- print("teams have been chosen")
- end
- for _, player in pairs(game.Players:GetChildren()) do -- this teleports the players
- local char = player.Character
- if player.Team == runnersTeam then
- char.HumanoidRootPart.CFrame = gamespawn.CFrame
- else
- char.HumanoidRootPart.CFrame = deathspawn.CFrame
- end
- end
- print("players have teleported to the game area")
- else --if the round isn't going, this places everyone in the neutral team and teleports them to the lobby
- local plrs = game.Players
- local Neutral = game.Teams.Neutral
- for i, plr in pairs(plrs:GetChildren()) do
- plr.Team = Neutral
- end
- print("all players have been placed in neutral")
- for _, player in pairs(game.Players:GetChildren()) do
- local char = player.Character
- char.HumanoidRootPart.CFrame = lobbyspawn.CFrame
- end
- print("players have teleported to the lobby")
- end
- end)
- local function RoundTimer() --this is the timer for the rounds. It changes the text in a GUI as well
- while wait() do
- if won.Value == false then
- music:Play()
- music1:Stop()
- for i = intermissionLength, 0, -1 do
- InRound.Value = false
- wait(1)
- status.Value = "Intermission: ".. i .." seconds left!"
- end
- music:Stop()
- music1:Play()
- for i = roundLength, 0, -1 do
- InRound.Value = true
- if #runnersTable == 0 then
- break
- end
- if won.Value == true then
- break
- end
- wait(1)
- status.Value = "Game: ".. i .." seconds left!"
- end
- local function test()
- if #runnersTable ==0 then
- status.Value = "Death has destroyed the runners!"
- wait(5)
- elseif #runnersTable >0 then
- status.Value = "The runners have ran out of time!"
- wait(5)
- end
- end
- test()
- else
- music:Stop()
- music1:Stop()
- music2:Play()
- for i = victoryLength, 0, -1 do
- wait(1)
- status.Value = "The runners have beaten death!"
- end
- for _, player in pairs(game.Players:GetChildren()) do
- local char = player.Character
- char.HumanoidRootPart.CFrame = lobbyspawn.CFrame
- end
- won.Value = false
- end
- end
- end
- spawn(RoundTimer)
Add Comment
Please, Sign In to add comment