Custom Chat Colour With Module Script Doesnt Work!

So, in the error it says that the chat color in the module isnt a color type. here is the error:
“TagColor is not a valid member of Color3 - Client - DefaultChatMessage:87”

(btw this error is from the roblox script)

if you need more info about the script or the error, feel free to reply!


Script:

game.Players.PlayerAdded:Connect(function(player)
	local module = require(game.ReplicatedStorage.Utils.Roles)
	
	local function isInRole(playerName, roleList)
		for _,v in pairs(roleList) do
			if v == playerName then
				return true
			end
		end
		return false
	end

	local function setChatTagsAndColor(tagName, tagColor, chatColor)
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
		local speaker = ChatService:GetSpeaker(player.Name)
		
		local tags = {
			TagText = tagName,
			TagColor = tagColor
		}
			
		while not speaker do
			wait(0.01)
			speaker = ChatService:GetSpeaker(player.Name)
		end
		speaker:SetExtraData("Tags", tags)
		speaker:SetExtraData("ChatColor", chatColor)
	end

	local tagName
	local tagColor
	local chatColor

	if isInRole(player.Name, module.Owners.Users) then
		tagName = module.Owners.Tag
		tagColor = module.Owners.TagColor
		chatColor = module.Owners.ChatColor
	end
	if tagName and chatColor and tagColor then
		setChatTagsAndColor(tagName, tagColor, chatColor)
	end
end)

Module Script:

local module = {
	Owners = {
		ChatColor = Color3.fromRGB(155, 133, 227),
		TagColor = Color3.fromRGB(106, 85, 220),
		Tag = "owner🔮",
		Users = {
			"secret-username-once-again"
		}
	}
}
return module
2 Likes

I’m not too familiar with this but, you are passing a table here, not the color3 ( i.e. tags.TagColor).

1 Like