Is it possible to make rainbow chat text in TextChatService?

Hi,

I want to know if it is possible to make rainbow chat text in the new chat service, TextChatService.

In the old text service, it was very easy to do but I don’t know if it’s possible on the new service since I never seen anyone do it.

Thanks for reading.

2 Likes

Here’s an example of what I mean:

1 Like

It is not possible in robloxs new textchatservice (to my knowledge) because robloxs actual gui for textchatservice is in coregui and using textchatserviceproperties doesnt work after its initally fused with the textchatmessage and changing textchatmessage doesnt work at all.

I have managed to partially replicate it but it was a little hacky

1 Like

why are you gatekeeping the code

Sorry, I changed the property for textcolor3 in textchatservice’s ChatWindowConfiguration to the RGB every heartbeat but if they didnt have the rgb enabled, I use overridemessageproperties on the incomingmessage callback to override that and make it the default text color. There’s probably a better way to do it and I might be recalling it incorrectly but it’s what worked for me.

2 Likes

thanks! i’ll try that and see if it works!

bruh its been 3 months and i still can’t do this, it changes the chat bubble to white and also the heartbeat lags the game

EDIT: I solved it now it’s ok

1 Like

Sorry for the bump.

This does not work for DisplaySystemMessage.

Also if anyone else wants to make these here is the code, with <rainbow> tags:

function gsub_literal(str, target, replacement) -- thx chatgpt
	local search_start = 1
	local result = {}

	while true do
		local found_start, found_end = string.find(str, target, search_start, true) -- 'true' makes it plain text search
		if not found_start then
			table.insert(result, string.sub(str, search_start))
			break
		end
		table.insert(result, string.sub(str, search_start, found_start - 1))
		table.insert(result, replacement)
		search_start = found_end + 1
	end

	return table.concat(result)
end
local function rainbowText(text)
	text = `<font color="rgb(255, 255, 255)">!{text}</font>`
	text = gsub_literal(text, "<rainbow>", "</font>")
	text = gsub_literal(text, "</rainbow>", '<font color="rgb(255, 255, 255)">')
	return text
end


TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local props = Instance.new("TextChatMessageProperties")

	props.Text = rainbowText(message.Text)
	return props
end
RunService.RenderStepped:Connect(function()
	TextChatService.ChatWindowConfiguration.TextColor3 = Color3.fromHSV((tick() / 5) % 1, 1, 1)
end)
2 Likes