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

How do I get the name of players on a team?

I read up on a previous page on how to get the names of players in-game, and then put them in a text box. I have tried adjusting the script but when I do so it errors out. I am hoping someone can help me do the same thing, but only with players from a set team. Any help is greatly appreciated.

1 answer

You are going to have to use the 'GetPlayers()' function.

game.Teams.TEAMNAME:GetPlayers()

Replace 'TEAMNAME' with the name of the team.

So basically, you could do a for loop.

for i,v in pairs(game.Teams.TEAMNAME:GetPlayers()) do 
print(v.Name) 
end

In a for loop, 'v' refers to the value, so for every player in the team, it will print out their name.

7 comments

1

I updated the answer with a way to get their names.

1

Mark it as answered please :D

0

I dont know how

1

Just click on the big green checkmark.

0

There is no checkmark\

1

WHY is this getting disliked, it's a perfectly good answer

0

Exactly, people are disliking me for no reason ;-;

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