How do you change the color of someone’s name tag in chat?

The title explains it all. If you’re confused what I mean, I’m talking about this:
IMG_3353

What I’m trying to do is make the name tag of anyone that joins to be lighter and softer looking so it is DEPENDING ON THEIR CURRENT COLOR. I’ve looked around YouTube and devforum for how to change the color but somehow no one has asked this question.

3 Likes

Im sure when they chat you can grab the color of the text and get the color from there

2 Likes

That’s what I tried but it won’t work

1 Like

Well shoot. Maybe player service or textChatService has something for it?

1 Like

I tried TextChatService already but not PlayerService, I’ll try looking around there and I’ll get back to you

1 Like

Nope, nothing I could find. Also just realized TextChatService I used OnIncomingMessage and it doesn’t print anything when I added a print inside the function

1 Like

Are you using TextChatService or LegacyChatService?

Here’s the TextChatService method (LocalScript):

local tcs = game:GetService("TextChatService")
local players = game:GetService("Players")

local function onIncomingMessage(message:TextChatMessage)
    --early return if it was a system message
    if not message.TextSource then return nil end

    --get the sender
    local player = players:GetPlayerByUserId(message.TextSource.UserId)

    --create properties for message
    local properties = Instance.new("TextChatMessageProperties")
    --set the colour (orange for example here)
    properties.PrefixText = `<font color = "rgb(255, 170, 0)">[{player.Name}]:`

    --return the properties to be used
    return properties
end

--set the callback
tcs.OnIncomingMessage = onIncomingMessage

I didn’t include the thing about the colours, can you provide more information about that?

1 Like

I’m using LegacyChatService but it’s the style that prefer though. Is there a way to this with Legacy?

Also by the colors, I just want to make player’s name colors to be lighter and softer.

I’m not sure there is a way with LegacyChatService to get the current chat tag of a player. Even then, LegacyChatService is deprecated. I’d recommend converting to TextChatService, you are able to modify the chat font, etc. to suit your preferences.

If you’re using the legacy chat you can just fork the scripts like this:

  1. Start a play test
  2. Search for ChatModules and copy it

image

  1. Stop the play test and paste the folder in ReplicatedStorage

  2. Open this script
    image

  3. Change these color values to the ones you want

  4. Run this in your command bar:
    game:GetService("ReplicatedStorage").ChatModules:Clone().Parent = game.Chat

3 Likes

Thanks so much it worked!!! You’re a lot of help, this took like 2 hours

1 Like