Hello Developers,
I’m currently need the rich text enabled for this new chat window. If you have a solution then can you please help me? Thank you soo much!!
Hello Developers,
I’m currently need the rich text enabled for this new chat window. If you have a solution then can you please help me? Thank you soo much!!
RichText works with TextChatService by default assuming you are using :DisplaySystemMessage. Your string is not valid rich text because you need to escape your angle brackets (replace them with <
and >
)
If you want a catch-all function, here you go.
local function makeTextRichTextable(rawText: string)
return rawText:gsub('&', '&'):gsub('[<>"\'"]', { -- ensure ampersands get replaced first because our escapes will be escaped, so the player will literally see "<" in the case of wanting to replace <
['<'] = '<';
['>'] = '>';
['"'] = '"';
['\''] = ''';
})
end
-- use:
script.Parent.MouseButton1Click:Connect(function()
local message = `<font color="rgb(255, 0, 0)">{ makeTextRichTextable('"\'<hello there & have a good day>\'"') }</font>`
game:GetService('TextChatService'):WaitForChild('TextChannels'):WaitForChild('RBXGeneral'):DisplaySystemMessage(message)
end)
Thanks, I will try it tomorrow to see if that works then let you know
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.