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

How to make a table of the players in a particular team ?

I was trying to make a different menu gui for the Vip Team and the Private Server owner

1 comment

0

This is not a request site.

1 answer

Creating tables for player in a team is easy.

Assuming that your team name is Vip. You can do:

local VipTeam = game.Teams.Vip -- It will get the team
local VipTeamTable = VipTeam:GetPlayers() -- This will create a table of the players in Vip team

GetPlayers() is used to calculate the amount of players.

Now, you have the table, you can do anything(not literally anything) with it, like:

local VipTeam = game.Teams.Vip 
local VipTeamTable = VipTeam:GetPlayers() -- It will get amount of players from Team Vip

-- If you will do, print(#VipTeamTable), it will print the number of players in Team Vip

for i, v in pairs(VipTeamTable) do -- Here, i is the number and v is the name associated with the number
	print(v) -- It will print the player's name in Vip team
end

Lemme know if it helps!

1 comment

0

Explain in further detail how and why this works

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