Wrong Round end

Hello Guys,
i have an issue with my Round system. I want when “Freefight” is true and the Round starts that it works like every other mode but just that when only 1 or 0 Fighter remains that the Round ends but now its when the Round starts, it immidiently ends and it show “Crew has won the Round” how can i fix this

local intermission = 20
local choose = 10
local roundLength = (math.random(2,4) * 60)
local Lobbywait = 30

local inRound = game.ReplicatedStorage.InRound
local ChooseMode = game.ReplicatedStorage.ChooseMode
local status = game.ReplicatedStorage.Status
local LStatus = game.Workspace:WaitForChild("Lobby").SystemSign.SurfaceGui.SIGN

local playingTeam = game.Teams.Playing
local lobbyTeam = game.Teams.Lobby

local Modes = game.ReplicatedStorage:WaitForChild("Modes")

local RoundTimer = game.ReplicatedStorage:WaitForChild("RoundTimer")

local roguesrevengeModule = require(game.ReplicatedStorage:WaitForChild("rougeRevengeSystem"))
local reversedModeModule = require(game.ReplicatedStorage:WaitForChild("reversedSystem"))
local deathModeModule = require(game.ReplicatedStorage:WaitForChild("deathmodeSystem"))
local murderMysteryModule = require(game.ReplicatedStorage:WaitForChild("murderMysterySystem"))
local freeFightModule = require(game.ReplicatedStorage:WaitForChild("freeFightSystem"))

local Sounds = game.ReplicatedStorage.Sounds

local function formatTime(seconds)
	local minutes = math.floor(seconds / 60)
	local remainingSeconds = seconds % 60
	return string.format("%02d:%02d", minutes, remainingSeconds)
end

local function lobbyCountdown()
	for i = Lobbywait, 0, -1 do
		status.Value = "Voting begins in " .. i .. " seconds"
		wait(1)
	end
end

inRound.Changed:Connect(function()
	if inRound.Value == true then
		for _, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local human = char:WaitForChild("Humanoid")

			plr.Team = playingTeam

			human.Died:Connect(function()
				plr.Team = lobbyTeam
			end)
		end
	else
		for _, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local humanRoot = char:WaitForChild("HumanoidRootPart")
			local human = char:WaitForChild("Humanoid")

			humanRoot.CFrame = game.Workspace.Lobby.lobbySpawn.CFrame

			plr.Team = lobbyTeam

			human:UnequipTools()
			plr.Backpack:ClearAllChildren()
		end
	end
end)

local function round()
	while true do
		local requiredPlayers = 3
		repeat
			wait(1)
			status.Value = "At least " .. requiredPlayers .. " players are needed to start a round"
		until #game.Players:GetPlayers() >= requiredPlayers

		inRound.Value = false

		-- Run the lobby countdown only once before the intermission
		lobbyCountdown()

		for i = intermission, 0, -1 do
			status.Value = "Research begins in " .. i .. " seconds"
			wait(1)
		end

		local modeBoolValues = Modes:GetChildren()
		local randomModeIndex = math.random(1, #modeBoolValues)
		local chosenModeBoolValue = modeBoolValues[randomModeIndex]

		chosenModeBoolValue.Value = true
		ChooseMode.Value = true

		for i = 5, 0, -1 do
			status.Value = "Mode gets Chosen"
			wait(1)
		end

		ChooseMode.Value = false
		inRound.Value = true

		if chosenModeBoolValue.Name == "Roguemode" then
			roguesrevengeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Reversed" then
			reversedModeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Deathmode" then
			deathModeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "MurderMystery" then
			murderMysteryModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Freefight" then
			freeFightModule.GiveWeapons()
		end

		local modeStartTime = tick() -- Record the time when the mode starts

		for i = roundLength, 0, -1 do
			local elapsedTime = tick() - modeStartTime
			local remainingTime = roundLength - elapsedTime

			status.Value = "Crew escapes in " .. formatTime(remainingTime) .. " Minutes"
			RoundTimer.Value = remainingTime  -- Update RoundTimer with remaining time

			local playing = {}
			local murderer = nil
			local nonMurderers = {}
			local death = nil
			local fighter = 0  -- Initialize fighter count to 0

			for _, plr in pairs(game.Players:GetChildren()) do
				if plr.Team.Name == "Playing" then
					table.insert(playing, plr.Name)
					if chosenModeBoolValue.Name == "Deathmode" then
						if plr:WaitForChild("Role").Value == "Death" then
							death = plr
						elseif plr:WaitForChild("Role").Value == "Rogue" then
							murderer = plr
						else
							table.insert(nonMurderers, plr)
						end
					elseif Modes:WaitForChild("Freefight").Value == true then
						-- Set the role "Fighter" for every player
						if plr:FindFirstChild("Role") then
							plr.Role.Value = "Fighter"
							table.insert(nonMurderers, plr)
							fighter = fighter + 1  -- Increment fighter count
						end
					else
						if plr:WaitForChild("Role").Value == "Rogue" then
							murderer = plr
						else
							table.insert(nonMurderers, plr)
						end
					end
				end
			end




			if murderer and not death and #nonMurderers == 0 then
				status.Value = "The Rogue has Won this Round"
				Sounds.Murder:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
				
			elseif death and (not murderer or i == 0) and #nonMurderers == 0 then
				status.Value = "The Death has Won this Round"
				Sounds.Death:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break

			elseif death and #nonMurderers > 0 and (not murderer or i == 0) then
				status.Value = "Death helped the Crew"
				Sounds.Innocents:Play()
				Sounds.Death:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
				
			elseif fighter == 1 then
				status.Value = "1 Person has survived"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif fighter == 0 then
				status.Value = "No one Remains this time"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break


			elseif #nonMurderers > 0 and (not murderer or i == 0) then
				status.Value = "The Crew won this Round"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break

			elseif #playing == 0 then
				status.Value = "Everyone died, Round end!"
				wait(3)
				chosenModeBoolValue.Value = false
				break
			

			elseif #playing == 1 then
				status.Value = playing[1] .. " Has Won The Game!"
				for i, plr in pairs(game.Players:GetChildren()) do
					if playing[1] == plr.Name then
					end
				end
				wait(3)
				break
			end
			wait(1)
		end
		wait(3)
	end
end


spawn(round)

In the section where you check if there’s only one fighter left, the round immediately ends. To fix this, you should wait until the end of the round to check if there’s only one fighter left.

-- keep previous code

local function round()
	while true do
		local requiredPlayers = 3
		repeat
			wait(1)
			status.Value = "At least " .. requiredPlayers .. " players are needed to start a round"
		until #game.Players:GetPlayers() >= requiredPlayers

		inRound.Value = false

		-- Run the lobby countdown only once before the intermission
		lobbyCountdown()

		for i = intermission, 0, -1 do
			status.Value = "Research begins in " .. i .. " seconds"
			wait(1)
		end

		local modeBoolValues = Modes:GetChildren()
		local randomModeIndex = math.random(1, #modeBoolValues)
		local chosenModeBoolValue = modeBoolValues[randomModeIndex]

		chosenModeBoolValue.Value = true
		ChooseMode.Value = true

		for i = 5, 0, -1 do
			status.Value = "Mode gets Chosen"
			wait(1)
		end

		ChooseMode.Value = false
		inRound.Value = true

		if chosenModeBoolValue.Name == "Roguemode" then
			roguesrevengeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Reversed" then
			reversedModeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Deathmode" then
			deathModeModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "MurderMystery" then
			murderMysteryModule.ChooseRoles()
		elseif chosenModeBoolValue.Name == "Freefight" then
			freeFightModule.GiveWeapons()
		end

		local modeStartTime = tick() -- Record the time when the mode starts

		for i = roundLength, 0, -1 do
			local elapsedTime = tick() - modeStartTime
			local remainingTime = roundLength - elapsedTime

			status.Value = "Crew escapes in " .. formatTime(remainingTime) .. " Minutes"
			RoundTimer.Value = remainingTime  -- Update RoundTimer with remaining time

			local playing = {}
			local murderer = nil
			local nonMurderers = {}
			local death = nil
			local fighter = 0  -- Initialize fighter count to 0

			for _, plr in pairs(game.Players:GetChildren()) do
				if plr.Team.Name == "Playing" then
					table.insert(playing, plr.Name)
					if chosenModeBoolValue.Name == "Deathmode" then
						if plr:WaitForChild("Role").Value == "Death" then
							death = plr
						elseif plr:WaitForChild("Role").Value == "Rogue" then
							murderer = plr
						else
							table.insert(nonMurderers, plr)
						end
					elseif Modes:WaitForChild("Freefight").Value == true then
						-- Set the role "Fighter" for every player
						if plr:FindFirstChild("Role") then
							plr.Role.Value = "Fighter"
							table.insert(nonMurderers, plr)
							fighter = fighter + 1  -- Increment fighter count
						end
					else
						if plr:WaitForChild("Role").Value == "Rogue" then
							murderer = plr
						else
							table.insert(nonMurderers, plr)
						end
					end
				end
			end

			if murderer and not death and #nonMurderers == 0 then
				status.Value = "The Rogue has Won this Round"
				Sounds.Murder:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif death and (not murderer or i == 0) and #nonMurderers == 0 then
				status.Value = "The Death has Won this Round"
				Sounds.Death:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif death and #nonMurderers > 0 and (not murderer or i == 0) then
				status.Value = "Death helped the Crew"
				Sounds.Innocents:Play()
				Sounds.Death:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif i == 0 and fighter == 1 then
				status.Value = "1 Person has survived"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif i == 0 and fighter == 0 then
				status.Value = "No one Remains this time"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif #nonMurderers > 0 and (not murderer or i == 0) then
				status.Value = "The Crew won this Round"
				Sounds.Innocents:Play()
				wait(2)
				chosenModeBoolValue.Value = false
				break
			elseif #playing == 0 then
				status.Value = "Everyone died, Round end!"
				wait(3)
				chosenModeBoolValue.Value = false
				break
			elseif #playing == 1 then
				status.Value = playing[1] .. " Has Won The Game!"
				for i, plr in pairs(game.Players:GetChildren()) do
					if playing[1] == plr.Name then
					end
				end
				wait(3)
				break
			end
			wait(1)
		end
		wait(3)
	end
end

spawn(round)

This now should check for one fighter remaining will only occur when the round time (i) is zero, preventing an immediate round end.

Further on if you have the players in a folder for fightings then just change the #playing to the folders name