Basically, in another script, each time a player dies on a team, the death value of the team is increased by 1. What this script is doing is breaking the rounds's for loop as soon as a team's death value equals to the number of players in that team. This will define the "WinningTeam" variable, either Red OR Blue. Everything works, except that the only way the for loop is broken is if a player leaves the game. I have no clue why, but maybe one of you guys can determine why the script is doing this. My script is below. Thanks for your time!;)
Round Script:
local RedDeaths = game.Workspace.Config.RedDeaths
local BlueDeaths = game.Workspace.Config.BlueDeaths
local WinningTeam
for i = 150,1,-1 do
if BlueDeaths.Value == #game.Teams.Blue:GetPlayers() then
WinningTeam = game.Teams.Red
break
end
if RedDeaths.Value == #game.Teams.Red:GetPlayers() then
WinningTeam = game.Teams.Blue
break
end
status.Value = "Time Left: "..i
wait(1)
end
status.Value = "Game End!"
print(BlueDeaths.Value,RedDeaths.Value,WinningTeam)
Team Death Value Script:
Player = game.Players.LocalPlayer
local RedTeamDeaths = game.Workspace.Config.RedDeaths
local BlueTeamDeaths = game.Workspace.Config.BlueDeaths
humanoid = Player.Character:findFirstChild("Humanoid")
function DisableBackpack()
local StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
function DiedX_X()
if Player.Team == game.Teams.Red then
print('1 red team player has died!')
RedTeamDeaths.Value = RedTeamDeaths.Value + 1
end
if Player.Team == game.Teams.Blue then
print('1 blue team player has died!')
BlueTeamDeaths.Value = BlueTeamDeaths.Value + 1
end
DisableBackpack()
end
humanoid.Died:connect(DiedX_X)

2 comments
Goulstem, that didnt seem to do really anything. Do you know of anything else i can try?
Welllll uhhh it should have. You could make sure that the values are actually being incremented.