Hi, I’m trying to completely recolor a player’s message, but it doesn’t work. Is it possible to recolor it? I got a duplicate text
local PlayerChatHandler = {}
PlayerChatHandler.__index = PlayerChatHandler
function PlayerChatHandler.new()
local self = setmetatable({}, PlayerChatHandler)
self.services = {
Players = game:GetService("Players"),
TextChatService = game:GetService("TextChatService")
}
self.chatWindowConfiguration = self.services.TextChatService.ChatWindowConfiguration
self.gradient = Instance.new("UIGradient")
self.gradient.Rotation = 90
self.gradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(0, 0, 0)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 0, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 0))
})
self:ConnectEvents()
return self
end
function PlayerChatHandler:ConnectEvents()
self.services.TextChatService.OnChatWindowAdded = function(message: TextChatMessage)
local properties: ChatWindowMessageProperties = self.chatWindowConfiguration:DeriveNewMessageProperties()
if not message.TextSource then
return
end
properties.PrefixText = string.format("<b>[Developer] %s %s</b>", message.PrefixText, message.Text)
properties.PrefixTextProperties = self.chatWindowConfiguration:DeriveNewMessageProperties()
self.gradient:Clone().Parent = properties.PrefixTextProperties
return properties
end
end
return PlayerChatHandler