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

How do I get all players from a team color and put them into random spots of a image label once?

Asked by 10 years ago

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.

2 answers

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago
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.

0
What do you mean by "List of image labels"? What do I put in there?? billybobtijoseph 1 — 10y
0
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. billybobtijoseph 1 — 10y
0
You put the list of image labels there. You do need to count if you intend to have each player in a different slot. 1waffle1 2908 — 10y
0
Like the names of the image labels?? Your kinda loosing me. billybobtijoseph 1 — 10y
View all comments (3 more)
0
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. 1waffle1 2908 — 10y
0
All of my image labels are the name "PlayerSpot" except one. Which is "KingSpot" billybobtijoseph 1 — 10y
0
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" billybobtijoseph 1 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Anyone else?

Answer this question