Speaker:SetExtraData erroring with Color3 value

Hello! I’m trying to create chat tags with a custom colour, however when a player speaks, this error follows:

TagColor is not a valid member of Color3  -  Client - DefaultChatMessage:50
   Stack Begin  -  Studio
   Script 'Chat.ClientChatModules.MessageCreatorModules.DefaultChatMessage', Line 50 - function CreateMessageLabel  -  Studio - DefaultChatMessage:50
   Script 'Players.bloorains.PlayerScripts.ChatScript.ChatMain.MessageLabelCreator', Line 100 - function CreateMessageLabel  -  Studio - MessageLabelCreator:100
   Script 'Players.bloorains.PlayerScripts.ChatScript.ChatMain.MessageLogDisplay', Line 101 - function AddMessage  -  Studio - MessageLogDisplay:101
   Script 'Players.bloorains.PlayerScripts.ChatScript.ChatMain.ChatChannel', Line 80 - function AddMessageToChannel  -  Studio - ChatChannel:80
   Script 'Players.bloorains.PlayerScripts.ChatScript.ChatMain', Line 761  -  Studio - ChatMain:761
   Stack End

I have to store the color differently as I’m saving it in a datastore, however I’m sure this isn’t the problem as I use it for another script and whenever you paste the numbers in manually, it works.

My script:

if ChatName and ChatColor then
	print(string.format("%s, %s, %s", ChatColor.r, ChatColor.g, ChatColor.b)) -- prints out the values
	Speaker:SetExtraData("Tags", {TagText = ChatName, TagColor = Color3.new(tonumber(ChatColor.r), tonumber(ChatColor.g), tonumber(ChatColor.b))})

The color is 0.45820873975753784, 0.9077450633049011, 1

Any help would be much appreciated. Thanks!

Update: I have tried putting it into a Color3Value, which works, but when you set the TagColor to that value, it runs the same error.

SetExtraData’s second argument should be an array of dictionaries (one for each tag), as it stands you’ve passed it a single dictionary.

1 Like

AH, how did I not notice that! Thank you very much, I’ve spent all day just trying to fix this :pensive: