I'm a newer scripter, so for my game i just looked up a round script that fit my standards for my 1v1 arena. The problem with this script is that when the intermission reaches 3, it gets stuck there and then the timer changes to 5 and this repeats, without ever going to roundTime. any fixes? are there any other problems as well, I dont want have to troubleshoot for hours.

local roundTime = 25
local Intermission = 20
local status = game.ReplicatedStorage:WaitForChild("status")
local Teams = game:GetService("Teams")
local skip = false

function sortTeams()
	local Players = game.Players:GetPlayers()
	local lobbyPlayers = game.Teams.Spectating:GetPlayers()
	
	local Fighting = math.random(1, #lobbyPlayers)
	lobbyPlayers[Fighting].Team = game.Teams.Fighting1
	table.remove(lobbyPlayers, Fighting)
	
	local Fighting2 = math.random(1, #lobbyPlayers)
	lobbyPlayers[Fighting2].Team = game.Teams.Fighting2
	
	local localTimer = roundTime
	while localTimer > 0 do
		status.Value = localTimer
		localTimer = localTimer - 1
		wait(1)
		local factive = false
		local f2active = false
		for _, Fighting in pairs(Teams.Fighting1:GetPlayers()) do
			if Fighting then
				factive = true
			end
		end
		for _, Fighting2 in pairs(Teams.Fighting2:GetPlayers()) do
			if Fighting2 then
				f2active = true
			end
		end
		if factive == false then
			status.Value = "Player 1 wins!"
			break
		end
		if f2active == false then
			status.Value = "Player 2 wins!"
			break
		end
		if localTimer == 1 then
			status.Value = "No one Wins"
		end
	end
	wait(1)
	roundTime = 0
	table.foreach(Players,function(_,player) player.Team = Teams["Lobby"] end)
end

wait(5)
while true do
	local skip = false
	status.Value = "Time Left:"..roundTime
	while Intermission > 2 do
		local players = game.Players:GetPlayers()
		if #players >= 2 then
			status.Value = "Intermission:"..Intermission
			Intermission = Intermission - 1
			wait(1)
		else
			while #players < 2 do
				players = game.Players:GetPlayers()
				status.Value = "Not Enough Players"
				wait(1)
			end
			skip = true
		end
	end
	wait(1)
	if skip == false then
		if roundTime ~= 0 then
			wait(1)
		end
	end
	Intermission = 5
	roundTime = 5
	skip = false
end