So I have this GUI with some image labels. I am trying to get all of the players on the team of Bright green and copy their names into string values. But I only want one of each player in 1 image labels string value. There are 6 open image labels with the string value of "PlayName". Can someone help me? I'm not sure how I would do the code.
COMMUNITY QUESTION
How do I get all players from a team color and put them into random spots of a image label once?
2 answers
local labels={list of image labels}
local count=1
for _,v in pairs(game.Players:GetPlayers())do
if v.TeamColor==BrickColor.new"Bright green"and labels[count]then
labels[count].PlayName.Value=v
count=count+1
end
end
Gets each player on the Bright green team and sets PlayName.Value to their username in order as they are found.
Anyone else?
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
What do you mean by "List of image labels"? What do I put in there??
Also I don't need it to count but I need it to get the players name and put them in a slot in one value each.
You put the list of image labels there. You do need to count if you intend to have each player in a different slot.
Like the names of the image labels?? Your kinda loosing me.
I don't know where any of your image labels are, I don't know your hierarchy, I don't know how you've set anything up. I can't give you the list because I don't have the list, you do.
All of my image labels are the name "PlayerSpot" except one. Which is "KingSpot"
I don't understand by what you mean "List". I have the script in a bool value. the bool is in a gui and then there is 2 frames. Backframe and then Frame. In that is an image label named "KingSpot" and the rest are named "PlayerSpot"