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

How do I get a Player's Chat Color?

Asked by
Kratos232 105
10 years ago

Hi. I'm making a custom chat GUI, and I want the Player's Name to be the same as their name would be with the normal ROBLOX chat system, but I need it to be a GUI. How would I get what color their name is? I have the GUI and everything, but I just can't get the Color.

0
I remember seeing a file that someone had leaked; it contained an algorithm supposedly used by ROBLOX to generate the chat color from some properties of a Player's name. If I ever find it, I'll let you know. Otherwise, there is no direct way to access a Player's chat color. duckwit 1404 — 10y
0
On the roblox forums, there was a post (not sure if by or just he responded to it) but Quenty showed a working algorithm that found the players chat color VariadicFunction 335 — 10y

2 answers

Log in to vote
1
Answered by 8 years ago
local CHAT_COLORS =
{
    Color3.new(253/255, 41/255, 67/255), -- BrickColor.new("Bright red").Color,
    Color3.new(1/255, 162/255, 255/255), -- BrickColor.new("Bright blue").Color,
    Color3.new(2/255, 184/255, 87/255), -- BrickColor.new("Earth green").Color,
    BrickColor.new("Bright violet").Color,
    BrickColor.new("Bright orange").Color,
    BrickColor.new("Bright yellow").Color,
    BrickColor.new("Light reddish violet").Color,
    BrickColor.new("Brick yellow").Color,
}

    local function GetNameValue(pName)
        local value = 0
        for index = 1, #pName do
            local cValue = string.byte(string.sub(pName, index, index))
            local reverseIndex = #pName - index + 1
            if #pName%2 == 1 then
                reverseIndex = reverseIndex - 1
            end
            if reverseIndex%4 >= 2 then
                cValue = -cValue
            end
            value = value + cValue
        end
        return value
    end

script.Parent.TextColor3 = CHAT_COLORS[(GetNameValue(INSERT_USERNAME HERE) % #CHAT_COLORS) + 1]

Replace INSERT_USERNAME HERE with the username

Ad
Log in to vote
-1
Answered by 10 years ago

In normal chat system it is found by using the Team Color. To make the gui you could do.

textgui.TextColor3=(game.Players.LocalPlayer.TeamColor).Color

Hope this helps. Might work, not positive

0
If there are no teams, then it is not decided by team color VariadicFunction 335 — 10y

Answer this question