How to prevent TextChannel:SendAsync() escaping "RichText characters"?

For a while I’ve been working on implementing a custom chat system based on TextChatService.
Just recently, I noticed that one of my test messages was able to render properly on the client that sent it, but not for the clients that received it.
Here’s what I mean:

Sender

Recipient

It turns out that by default, TextChatService internally escapes RichText characters.
The only reasoning regarding this that I’ve been able to find being “to prevent users from making their messages appear with RichText”.

My question is… why? and is there a workaround?

  • (in the case of a custom chat) TextLabels have a RichText property. Devs that don’t want players’ messages to appear with RichText can just turn it off with 1 click.
  • (in the case of default chat) Roblox can internally strip out these tags through pattern matching at minimum.

I’ve even seen bug reports where devs are ASKING the engineers to also escape rich text through the DisplaySystemMessage function, but I’m just sitting here wondering why you’d shoot yourself in the foot like that.

Personally, as I’ve already showcased, this internal meddling by Roblox’s default behavior is interfering with what I’m trying to achieve and I’d rather see this either disappear or turn into a toggle on the TextChatService instance.

For now though, is there any way for me to work around this undesirable behavior?

1 Like

After some more searching, turns out the workaround is to simply replace the code of the RichText characters with the characters themselves when parsing the incoming message’s contents.

This works okay for me, I can accept it, but only because I can park it alongside a pile of existing workarounds for various other related things.
It’d be really nice if I wouldn’t have to waste resources like this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.