Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Detect if there is less than or equal to 1 person left on the team?

I've been trying to make a script that can detect how many people are on a team and if there is less than or equal to one person on a team.

This is what I've gotten so far but have no idea what to do and i'm stuck. Here is the script.

teams = game.GetService("Teams") team1 = teams.Playing local team1players

function onGameEnd()

team1players = team1:GetChildren()

if #team1players < 2 then

print("players less than 2")

end end

1 answer

Pretty simple just change < to <=.

teams = game.GetService(“Teams”)  
team1 = teams.Playing  
local team1players

function onGameEnd()

team1players = team1:GetChildren()

if #team1players < 2 then

print(“players less than 2”)

end  
if #team1players <= 1 then

print(“players equal to or less then 1”)

end  
end

You can also find more information here.

1 comment

0

I changed the code to this change the function to while true do and I still get no output in the console even when Team1Players is less than or equal to one.

This discussion is preserved as it was. New answers, comments, and votes are closed.