Getting players chat color

  1. What do you want to achieve? I am trying to make a custom chat

  2. What is the issue? I do not know how to get a players chat color for example this;
    Screenshot_3

  3. What solutions have you tried so far? Yes, I have looked all over developer forums.

I do not know how to return a players chat color. I have tried but failed.

3 Likes

Check out this video, covers it pretty well:

1 Like

No, I am trying to get the players chat color, not make one.

From what I remember, the players that color, at least used to, be set by what age their account was in, or perhaps what date of birth the account has.

This can help.

local NAME_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

local color_offset = 0
local function ComputeNameColor(pName)
	return NAME_COLORS[((GetNameValue(pName) + color_offset) % #NAME_COLORS) + 1]
end
local predictedColor = ComputeNameColor("typechecked")

And if you want to turn that color to an RGB value you can add this:

local r, g, b = predictedColor.R*255, predictedColor.G*255, predictedColor.B*255
print(math.round(r).. ", "..math.round(g)..", "..math.round(b))
8 Likes

How do I use this? Also I am trying to get the name tag color.

print(ComputeNameColor("firasthe2")) --> prints Color value of your name tag from chat
1 Like

thanks alot it worked correctly

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.