Hello! I am currently trying to make some chat tags for my upcoming game and I would like to know how people go about setting chat tags as well as using gradients with the new(er) TextChatService. Any help is appreciated as always.
This is the code I’ve tried so far… I’ve played around with it but can’t seem to get this to work, it kinda just sets the name of the sender to what I want to be the prefix text, and also has no gradient.. Kinda lost.
function ChatTagHandler:Connect()
TextChatService.OnIncomingMessage = function(message : TextChatMessage)
local properties = ChatWindowConfig:DeriveNewMessageProperties()
local source = message.TextSource
--
if source and source.UserId then
local tagData = ChatTagProperties[self.ActiveChatTag]
local tagText = tagData and tagData.Content or ""
--
properties.PrefixText = tagText
--
if tagText and tagText ~= "" then
local prefixProperties = ChatWindowConfig:DeriveNewMessageProperties()
--
local gradient = Instance.new("UIGradient")
gradient.Color = tagData.GradientColor
gradient.Parent = prefixProperties
--
properties.PrefixTextProperties = prefixProperties
end
end
--
return properties
end
end