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 7 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 :

1Site Director

3 answers

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

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 — 7y
Ad
Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
7 years ago

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

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

thanks you everyone for Helping !

Answer this question