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

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

Asked by 3 years ago

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

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

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.

1
I updated the answer with a way to get their names. YAYAYGPPR 82 — 3y
1
Mark it as answered please :D YAYAYGPPR 82 — 3y
0
I dont know how Kenmanrulez 0 — 3y
1
Just click on the big green checkmark. YAYAYGPPR 82 — 3y
View all comments (3 more)
0
There is no checkmark\ Kenmanrulez 0 — 3y
1
WHY is this getting disliked, it's a perfectly good answer Fifkee 2017 — 3y
0
Exactly, people are disliking me for no reason ;-; YAYAYGPPR 82 — 3y
Ad

Answer this question