Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Know if a team is empty or not ?

Asked by 6 years ago

**hello everyone **

I would like to know how to make a script that detects if a team is empty or not (team name: Site Director) thanks for helping!

team name :

Site Director

3 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
if #game:GetService("Teams"):FindFirstChild("Site Director"):GetPlayers() == 0
    then print("EMPTY")
else print("NOT EMPTY")
end

or you can wrap it in a function and call it whenever ya want :)

0
can i put in a "While true do" sheppard929 9 — 6y
Ad
Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

You can check the length of Team:GetPlayers() and compare it to 0

local function IsTeamEmpty(team)
    return #team:GetPlayers() == 0
end

local isEmpty = IsTeamEmpty(game:GetService("Teams"):FindFirstChild("Site Director"))
print(isEmpty)
0
and if the team is not empty ? sheppard929 9 — 6y
0
If it's not empty, the function will return false, otherwise will return true Amiaa16 3227 — 6y
0
and if i want make a button invisible when team is full, how can i do ? sheppard929 9 — 6y
Log in to vote
0
Answered by 6 years ago

thanks you everyone for Helping !

Answer this question