EDITED WITH WHAT I NOW HAVE
local players = game.Players:GetPlayers()
local blue = {}
local red = {}
for number = 1, #players do
local setPlayer = players[number]
if setPlayer.TeamColor == BrickColor.new("Cyan") then
table.insert(blue, players)
elseif setPlayer.TeamColor == BrickColor.new("Persimmon") then
table.insert(red, players)
end
end
for number = 1, #blue do
local setPlayer = blue[number]
local frames = {}
for i = 1, 9 do
frames[i] = blueBox.PlayerBox:WaitForChild("Player" .. i)
end
if setPlayer then
frames[number].NameLabel.Text = setPlayer.Name
end
end
for number = 1, #red do
local setPlayer = red[number]
local frames = {}
for i = 1, 9 do
frames[i] = redBox.PlayerBox:WaitForChild("Player" .. i)
end
if setPlayer then
frames[number].NameLabel.Text = setPlayer.Name
end
end
This script basically gets all the players in the game, and sorts them into 2 tables, red and blue
Then I have 2 for loops, which go through the tables, and get the players in the table, and sets a TextLabel.Text to equal the name of the player.
The problem is that instead of having 1 frame saying Player1 and the other Player2 it has both as the LocalPlayer, so on Player1's screen, it has both frames on the blue and red side saying Player1, and vice versa for Player2

1 comment
it has an error on line 32 of my code, saying 'bad argument #3 to Text (string expected, got nil)'