Change name color

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I would like to be able to change the name color.

  2. What is the issue? Include screenshots / videos if possible!
    The name color doesn’t change and the name gets replace by Color:ToHex() value.
    The tag color is right tho.
    In the else the name is right and it changes color.

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players") 
local player = script.Parent.Parent
player.CharacterAdded:Wait()
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("="..player.Name)
local Color

local function OnIncomingMessage(message: TextChatMessage): TextChatMessageProperties
	local properties = Instance.new("TextChatMessageProperties")
	
	Color = Tag:GetAttribute("Colore")
	
	if Tag:GetAttribute("Intro") == false then
		properties.PrefixText = string.format("<font color='#FFFFFF'><b>[Noob]</b></font> %s", Color:ToHex(), message.PrefixText)
	else
		properties.PrefixText = string.format("<font color='#%s'>%s</font>", Color:ToHex(), message.PrefixText)
	end

	return properties
end

TextChatService.OnIncomingMessage = OnIncomingMessage

Screenshot (1124)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    found nothing.
1 Like

Are there any errors in the Output?

There are no output errors @TestyLike3

You need to wrap the <font> tag around the entire prefix text if you want it to color-correct everything:

if Tag:GetAttribute("Intro") == false then
	properties.PrefixText = string.format("<font color='#FFFFFF'><b>[Noob]</b> %s</font>", Color:ToHex(), message.PrefixText)
else
	properties.PrefixText = string.format("<font color='#%s'>%s</font>", Color:ToHex(), message.PrefixText)
end
2 Likes

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