Setting custom chat tags and chat colours using ExtraDataInitializer


I was recently introduced to the ExtraDataInitializer module in another post, looking through it, I think I understand what’s going on. The issue seems to be the chat tags though. I’m able to create the tags, but I’m not sure how to actually apply them to the speaker. It does apply in the chat though, but there are multiple tags, and they apply to everyone… I also don’t understand custom methods completely, so I have no idea what :GetExtraData is.

I’ve tried researching this but there isn’t much online that I was able to find.

Here is the table with the tags:
		if not speaker:GetExtraData("Tags") then

			local tags = {
					TagText = "Owner",
					TagColor =, 116, 255)
					TagText = "Contributor",
					TagColor =, 0, 0)

			speaker:SetExtraData("Tags", tags)

Here's the script to apply the settings from the tables above
    --Where does the user ID go?
	local function onNewSpeaker(speakerName)
		local speaker = ChatService:GetSpeaker(speakerName)
		if not speaker:GetExtraData("NameColor") then
			speaker:SetExtraData("NameColor", GetNameColor(speaker))
		if not speaker:GetExtraData("ChatColor") then
			local specialChatColor = GetSpecialChatColor(speakerName)
			if specialChatColor then
				speaker:SetExtraData("ChatColor", specialChatColor)

I normally don’t recommend you fork the ExtraDataInitializer and let it, as the module’s name states, initialise ExtraData for ChatSpeakers. This is usually just funky stuff like giving Roblox staff their special chat data and general set up. You can usually just have this done independently.

Get/SetExtraData are just ways to read and write from a table, plus some extra internal necessities such as firing events. Think of it like Get/SetAsync from a DataStore. GetExtraData takes a key and returns a value, SetExtraData takes both a key and a value then sets the index at key to value (table[key] = value).

You’ve basically already got it down, anyway. In order to apply tags to the speaker, you simply use SetExtraData and pass a table as the value which should contain tables of tag data - you have that down in the first code sample.

If you want to get the UserId of a speaker, first you need to check if it’s a valid player speaker in the first place. ChatSpeaker objects provide a method of getting an associated player (if there is one), GetPlayer. Under GetSpeaker in the second code sample, just chuck in

local player = speaker:GetPlayer()

Assuming the ChatSpeaker belongs to a player and isn’t a playerless entity (ChatSpeakers can be created for NPCs, the server and any other entity as well) which you can check with if player then, you can access their UserId as normal from player.UserId.

I wrote some chat tag code some time back in a tutorial I wrote. It features applying special tags and VIP tags to players independent of the Lua Chat System. Read that here: