Get player teamcolor in a textcolor

Hello, (ik I’m annoying :stuck_out_tongue_winking_eye: )
I’m trying to FINALLY finish the spectating GUI, I got this script :

-- Disable the player list / leaderboard
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
-- Variables
local playerListButton = script.Parent:WaitForChild("PlayerListButton")

local playerListFrame = script.Parent:WaitForChild("MainFrame")

-- Open/Close Gui

-- Updating the leaderboard
while wait(1) do
	-- Deletes everything until we make a frame
	for _, plrFrame in pairs(playerListFrame.PlayerHolder:GetChildren()) do
		if plrFrame:IsA("Frame") then
			plrFrame:Destroy()
		end
	end
	
	-- Making a frame for the player
	for i, plr in pairs(game.Players:GetPlayers()) do
		local template = script:WaitForChild("Template"):Clone()
		template.Name = plr.Name
		template.PlayerPicture.Image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
		template.PlayerPicture.PlayerName.Text = plr.Name
-- Should go here
		template.Parent = playerListFrame.PlayerHolder
	end
	
	if #game.Players:GetPlayers() >= 7 then
		playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,1.05 + ((#game.Players:GetPlayers()-7) * .15),0)
	else
		playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,0,0)
	end
end

I just want, to facilitate player navigation, to get the player team color (Exemple the player is in the red team, the color will be red, if he’s in blue, it’ll be blue, etc…)
How can I do that :slight_smile:

Teamcolors are Brickcolor values, and brickcolors have a .Color property, which is the corresponding Color3. If the template is the object that contains the text, this should work. Otherwise, you’ll need to first index the object that contains the text, of course.

template.TextColor3 = plr.TeamColor.Color
1 Like

You can do it by getting all the players in a team: game.Teams.NameOfTheTeam:GetPlayers()

Once you take all the players in a team you can set the camera of the spectator on each players you’ve taken.