TagColor is not a valid member of Color3

Hello Developers!

Recently I started scripting a system that passes information from tables into a function that sets a players chat color or adds tags.

For example I have this table here that handles tag information and passes it into a function

local Colors = {
	["Gamepass Colors"] = {
		["DiamondMember"] = {Color3.fromRGB(175, 221, 255), 0, "💎Diamond Member💎"},
		["GoldMember"] = {Color3.fromRGB(239, 184, 56), 0, "⭐Gold Member⭐"},
	},
	["Execlusive Colors"] = {
		["dacastle"] = {Color3.fromRGB(255, 0, 0), 0, ""},
		["aIphabox"] = {Color3.fromRGB(255, 155, 240), 0, ""},
		["EgghuntWinner"] = {Color3.fromRGB(255, 155, 240), 0, ""},
	}
}
local function SetColor(Player, Color, Rank, Tag)
	local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
	local TagText = Tag
	local TagColor = Color
	local Speaker = nil
	local Tag = {
		TagText = TagText,
		TagColor = TagColor
	}
	while Speaker == nil do
    	Speaker = ChatService:GetSpeaker(Player.Name)
    	if Speaker ~= nil then break end
  		wait(0.01)
	end
	if Tag ~= "" then
		Speaker:SetExtraData("Tags", Tag)
	end
	print(TagColor)
	Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 0, 0))
end

But when I chat my message doesn’t show and it errors on line 18 of the function:
TagColor is not a valid member of Color3
which links you to image
of DefaultChatMessage?

Any reason why this is happening?

1 Like

That SetExtraData call takes an array of tags, eg. {{TagText="Hello",TagColor=Color3.new(1,0,0)},{TagText="AAAA",TagColor=Color3.new(0,0,0)}}, and you’re only passing a single tag to it.

This can be solved by changing

Speaker:SetExtraData("Tags", Tag)

to

Speaker:SetExtraData("Tags", {Tag})
5 Likes