Basically I’m trying to get multiple chat tags work with gradients when typing a chat message with the TextChatService. I can create one but not multiple. I’ve seen it in another game so it has to be possible. If you know anything please tell me.
Here is my code:
textChatService.OnChatWindowAdded = function(message:TextChatMessage)
local properties = chatWindowConfig:DeriveNewMessageProperties()
local textSource = message.TextSource
local userId = textSource.UserId
local r, g, b = ComputeNameColor(game.Players:GetNameFromUserIdAsync(userId))
local color = toHex(Color3.fromRGB(r, g, b))
if textSource then
local prefix
local specialRole = specialRoleModule.check(userId)
if specialRole then
prefix = "["..specialRole.."]"
end
if prefix then
properties.PrefixText = prefix
properties.PrefixTextProperties = chatWindowConfig:DeriveNewMessageProperties()
local gradient = Instance.new("UIGradient")
gradient.Color = chatTagModule[specialRole]["GradientOptions"]["Color"]
gradient.Offset = chatTagModule[specialRole]["GradientOptions"]["Offset"]
gradient.Parent = properties.PrefixTextProperties
end
properties.Text = string.format("<font color='"..color.."'>%s</font>", message.PrefixText).." "..message.Text
end
return properties
end