I have a game, which uses rounds of 5 mins each. Currently, I'm setting up a Deathmatch Round. Here are my Problems:
function ChooseTeam() Players = game.Players:GetPlayers() for i = 1,#Players do Players[i].TeamColor = game.Teams.Playing.TeamColor end end function ChooseMap() Maps = game.Lighting.Maps:GetChildren() chosen = Maps[math.random(1,#Maps)]:Clone() chosen.Parent = game.Workspace end function Classic() Text = "Round Chosen: Classic" for i=1,#Text do game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Round.Text = Text:sub(1,i) wait(0.1) end ChooseMap() Map = "Map Chosen: "..chosen.Name for i=1,#Map do game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Map.Text = Map:sub(1,i) wait(0.1) end game.Workspace:WaitForChild(chosen.Name).Name = "Map" ChooseTeam() players = game.Players:GetPlayers() for i=1,#players do players[i]:LoadCharacter() game.Lighting.Starter:Clone().Parent = players[i].Backpack end game.Workspace.Time.Value = 5*60 game.Players.PlayerAdded:connect(function(player) if game.Workspace.Time >10 then player.TeamColor = game.Teams.Playing.TeamColor a = game.Lighting.Starter:Clone() player:WaitForChild("Backpack") a.Parent = player.Backpack wait(0.5) player:LoadCharacter() end end) game.Players.PlayerRemoving:connect(function(player) if game.Players.NumPlayers < 2 then Players = game.Players:GetPlayers() for i = 1,#Players do Players[i].TeamColor = game.Teams["Not Playing"].TeamColor Tools = Players[i].Backpack:GetChildren() for w=1,#Tools do if Tools[w]:IsA("Tool") then Tools[w]:Destroy() end end wait(0.5) Players[i]:LoadCharacter() end game.Workspace.Time.Value = 0 game.Workspace:WaitForChild("Map"):Destroy() end end) while wait() do if game.Workspace.Time.Value == 0 then for i=1,#players do if game.Players:FindFirstChild(players[i]) then items = players[i].Backpack:GetChildren() for b = 1,#items do if items[b]:IsA("Tool") then items[b]:Destroy() end end players[i].TeamColor = game.Teams["Not Playing"].TeamColor wait(0.5) players[i]:LoadCharacter() end end game.Workspace:FindFirstChild("Map"):Destroy() break end end end function ChooseRound() Round = {"Classic"} Rchosen = math.random(1,#Round) if Rchosen == 1 and game.Players.NumPlayers >= 2 then Classic() end end while wait(10) do if game.Players.NumPlayers >= 2 then ChooseRound() end end
Could someone please help me out?
P.S: If you would like to be credited on the game, please tell me.