Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a billboard gui be the same color as their team color?

This script is in StarterCharacterScript.

The Name Tag's parent is the Script.

wait()

--//Base elements
local Character = script.Parent
local NameTag = script:FindFirstChild("NameTag")

--//Custom elements
local GroupID = 0000000

local NameTagClone = NameTag:Clone()
NameTagClone.Parent = Character:FindFirstChild("Head")
NameTagClone.Adornee = Character:FindFirstChild("Head")
NameTagClone.Frame.GroupRank.Text = game.Players:GetPlayerFromCharacter(Character):GetRoleInGroup(GroupID)
NameTagClone.Enabled = true
-- Name Tag Color
local PlayerName = Character.Name
if game.Players[PlayerName].TeamColor == "Really Black" then
	NameTagClone.Frame.Username.Text.TextColor3 = Color3.new(17,17,17)
end

2 answers

Here's a little thing that should help you, I believe the TeamColor is going by BrickColor so you should be able to get the Color3 value of that pretty easily.

local Players = game:GetService("Players")

local Character = (script.Parent:IsA("Model") and script.Parent) or script:FindFirstAncestorOfClass("Model")
local Player = Players:GetPlayerFromCharacter(Character)

local NameTag = script:FindFirstChild("NameTag")

repeat
	wait()
until NameTag ~= nil

local NTC = NameTag:Clone()
NTC.Parent = Character:FindFirstChild("Head")
NTC.Adornee = Character:FindFirstChild("Head")
NTC.Frame.GroupRank.Text = Player:GetRoleInGroup(0000000)
NTC.Enabled = true
NTC.Frame.Username.Text.TextColor = (Player.TeamColor.Color) or Color3.fromRGB(128,128,128)

Your code:

local PlayerName = Character.Name -- that would just be character? (bad)
if game.Players[PlayerName].TeamColor == "Really Black" then -- good
    NameTagClone.Frame.Username.Text.TextColor3 = Color3.new(17,17,17) -- no has to be 0-1
end

edited code:

local PlayerName = game.Player:GetPlayerFromCharacter(Character).Name
if game.Players[PlayerName].TeamColor == "Really Black" then 
    NameTagClone.Frame.Username.Text.TextColor3 = Color3.new(17/255,17/255,17/255) 
end

Reasoning on edit:

Character.Name would just be "character", not the play's name, so use game.Player:GetPlayerFromCharacter(Character).Name

and also Color3.new(17,17,17) must be Color3.new(17/255,17/255,17/255)

3 comments

0

That did not change one thing. I am trying to make it so that if a player is a specific Team Color then the Usernames text would be a specified color...

0

oh, lemme see

0

thats not possible without using an api

This discussion is preserved as it was. New answers, comments, and votes are closed.