System messaging with gradients (TextChatService)

Ok so i need to create some system messages such as “[SYSTEM] placeholder” and i’ve got most of it down including the gradient

image

However as you can see theres a duplicate message and i believe thats because of DisplaySystemMessage.

heres how i handle it,

TextChatService.OnChatWindowAdded = function(message: TextChatMessage)
	local properties = ChatWindowConfig:DeriveNewMessageProperties()
	print(message.TextSource, message.Text)

	
	properties.PrefixTextProperties = ChatWindowConfig:DeriveNewMessageProperties()
	properties.PrefixText = message.Text
	properties.Text = ""
	
	local GradClone = ChatGradient:Clone()

	GradClone.Rotation = -90
	GradClone.Color = ColorSequence.new({
		ColorSequenceKeypoint.new(0, Color3.fromRGB(25,25,25)),
		ColorSequenceKeypoint.new(0.25, Color3.fromRGB(50,50,50)),
		ColorSequenceKeypoint.new(0.5, Color3.fromRGB(100,100,100)),
		ColorSequenceKeypoint.new(1, Color3.fromRGB(150,150,150))
	})
	GradClone.Parent = properties.PrefixTextProperties
	
	return properties
end

messageRemote.OnClientEvent:Connect(function(messageType, message, colour, special)
	textChannels.RBXSystem:DisplaySystemMessage("[SERVER] "..message)
end)

I’m unaware if theres a better way, the doc was very vague and the forum that discussed the new gradient feature was also very vague. I’ve seen other games do it so im hoping to replicate it!

When you set the ChatWindowMessageProperties’s Text property to an empty string, Roblox interprets it as you not trying to override the message content.

You can fix this by setting properties.Text to any non-empty string. If you are worried about affecting the spacing of messages by appending a space at the end, you can instead use a zero-width unicode character like this: "​".

Hope this helps.

wow thats very cheesy :sob: really appreciate it, would not have figured that out otherwise.