Hi there, I just wanted to ask you guys if you knew how to end/restart a round in my round based game is all players are on one team. I will put my entire script so you can understand:

local status = game.ReplicatedStorage:WaitForChild("Status")
local Players = game.Players:GetPlayers()

while true do
	for i = 10, 1, -1 do
    	status.Value = "Intermission..("..i..")"
    	wait(1)
	end
	target = CFrame.new(-131.76, 18.66, -120.07) --could be near a brick or in a new area
	for i, player in ipairs(game.Players:GetChildren()) do
    	player.Character.Head.CFrame = target + Vector3.new(0, i * 5, 0)
    	--add an offset of 5 for each character
	end
	function setTeam(player, teamName)
    	player.TeamColor = game.Teams[teamName].TeamColor
    	if player.Character then --Just in case the character doesn't exist for some reason
    	end
	end
	for _, player in pairs(game.Players:GetPlayers()) do
    	setTeam(player, "Playing")
	end
	status.Value = "Round in progress..."
	script.Value.Value = true
	for i = 250,1,-1 do	
		status.Value = "Round in progress... ("..i..")"
		wait(1)
	end	
	for i = 1, #Players do 
    	local player = Players[i]
    	if player.Team ~= game.Teams.Playing then 
        	game.ReplicatedStorage.Status.Value = "Round ended..."
			game.ServerScriptService["Status Changer"].Disabled = true
    	else
        	break
    	end
	end
	wait(5)
	status.Value = "Time is up!"
	wait(4)
	game.Workspace.Interactives._Button1.Value.Value = false
	game.Workspace.Interactives._Button1.Light.BrickColor = BrickColor.new("Bright green")
	game.Workspace.Interactives._Button1.Light.Material = Enum.Material.Neon
	game.Workspace.Interactives._Button2.Value.Value = false
	game.Workspace.Interactives._Button2.Light.BrickColor = BrickColor.new("Bright green")
	game.Workspace.Interactives._Button2.Light.Material = Enum.Material.Neon
	for i,Player in ipairs(game.Players:GetChildren()) do
		Player.Team = game.Teams.Lobby
	end
	script.Value.Value = false
end

If you would tell me how to do this and where to put it, I would greatly appreciate it. Thanks!

2 comments

0

Try using functions

0

What do you mean?