New Beta In-Experience Chat System for Channels, Filtering and More!

Hey developers! I’m excited to introduce an exciting new option for text chat in your experiences - TextChatService!

Screen Shot 2022-03-29 at 1.20.25 PM

Overview

TextChatService is our new successor to the existing Chat service, and makes the process of managing channels, decorating messages, filtering text, creating commands, and developing custom chats much more simple.

In addition, this system is much easier and sustainable for engineers at Roblox to iterate on and will receive regular fixes & new features over time without conflicting with any code you may have written that uses it.

If you’d prefer to make your own frontend GUI for chat, this should help streamline your development process by handling the chat boilerplate code for you.

How is TextChatService different from Chat service?

TextChatService formalizes the sending and delivery of chat messages specifically within the Roblox engine and treats the data it receives appropriately with that context.

Think of this feature as the sum of two parts:

API

The most notable piece de resistance aspect of the next TextChatService is how TextChannel:SendAsync operates. SendAsync will handle all the important policy-abiding business logic that every Roblox experience must follow for developers.

Here’s a laundry list of details that are automatically handled when using TextChatService API:

  • Text filtering
  • Message size limits/rate limiting
  • Respecting chat privacy settings
  • Message replication
  • Channel permissions
  • Command logic

Frontend

In addition to the API, TextChatService can also optionally provide a default frontend chat UI for your experience. Instead of “forking” chat player scripts to tailor the default UI for your experience, we plan to expose formal Roblox APIs (see ChatWindowConfiguration and ChatInputBarConfiguration to edit the look and feel of the chat. You can also disable the default frontend completely and still get the benefits of the new TextChatService instances for your own custom chat UIs!

Additionally, you can alter message styling without overriding our existing UI using OnIncomingMessage hooks and [RichText tags - which means you can customize it to fit your experience.

New objects and services (formal documentation pending)

  • TextChatService - The top-level container for the new chat system. Chat objects must be parented under this.

  • ChatWindowConfiguration - Created automatically and parented under TextChatService, controls chat window style/behavior

  • ChatInputBarConfiguration - Created automatically and parented under TextChatService, controls chat window style/behavior

  • TextSource - Represents a speaker in a TextChannel,

  • TextChannel - Represents a text channel. Contains TextSources. Calling SendAsync from a client with a TextSource in that channel that has CanSend = true will send a chat message.

  • TextChatCommand - When a message with a prefix matching the Primary or Secondary alias is sent, the Triggered event will fire on the sending client and on the server

  • TextChatMessage - Immutable data object used to represent a chat message

  • TextChatMessageProperties - When returned from the TextChatService.OnIncomingMessage or TextChannel.OnIncomingMessage callbacks, will overwrite the matching properties on the TextChatMessage. Can be used to add rich text tags to a message.

How to opt-in

First, enable the Text Chat Service beta from the Studio beta menu & restart studio:

Next, when you open a place, you should see TextChatService in your explorer:

Click on this and change the ChatVersion property from LegacyChatService to TextChatService. This will disable the old chat from loading by default, and enable the new system:

…and you’re done! If you haven’t forked the old chat system, you shouldn’t have to make any changes. If you have, you may run into some issues as missing chat modules will no longer be automatically loaded in.

Demos

Adding name colors

See StarterPlayer.StarterPlayerScripts for relevant TextChatService code

NameColorDemo.rbxl (38.7 KB)

Adding commands

See ServerScriptService for for relevant TextChatService code

CommandsDemo.rbxl (38.4 KB)

Adding a VIP tag

See StarterPlayer.StarterPlayerScripts for for relevant TextChatService code

VIPDemo.rbxl (39.9 KB)

FAQs

Is the old Chat service going away? Do I have to migrate my existing custom chats?

  • No. We have future plans to deprecate Chat service in favor of this, but you will not be forced to use TextChatService. While we encourage you to use our new chat objects (TextChannel, TextSource, TextChatCommand) to handle the replication of messages for safety purposes, you are still free to write your own chat systems as long as messages are properly filtered. There will be an extended period of time where we are strictly taking feedback to improve the new TextChatService system before we even consider deprecating the existing service.

Where’s the documentation?

  • Full documentation and tutorials are still pending, and will be added here when completed!

Where are the name colors?

  • We’re still ironing out whether we should do this by default, have an API for it, or leave this to developers. If you would like to implement name colors as they are right now, here is a demo place (38.7 KB) that shows how this can be implemented. If you have an opinion on this, please let us know!

What about BubbleChat?

  • Currently, BubbleChat API lives in the old Chat service. Exposing BubbleChat controls through a TextChatService member is something we intend to support very soon.

Next steps

We’re aiming to support as many chat use cases as we can, and not to build a product that you’re forced to use, but that you want to use. In doing this, we would really appreciate your feedback - is there something you would add to the configuration objects? Is there a reason you forked the old chat that is still an issue in this chat? Do you feel like there’s an event or helper function that could make your experience using this easier? Let us know about these and any issues you may encounter!

Thanks!

472 Likes

This topic was automatically opened after 10 minutes.

Not going to lie? I was a little terrified with the new chat API because it seemed like Roblox was reeling in even more APIs back to CoreScript status and I hate when I lose more control over features in my experience, being forced to write them from ground up when Roblox goes CoreScript instead of extensibility. I see that my fears seem to have been greatly unfounded.

Having Roblox take care of a multitude of policy-abiding business and backend systems while keeping extensibility for developers is a very welcome way of handling features in the engine and I strongly encourage more of this (cough, humanoid componentisation when?). As a developer, I love to have as much control over as many aspects of my experience as possible; and when Roblox provides a solution, I want to extend the default behaviour with my own code and designs.

Customising the existing Lua Chat System deeply beyond aesthetics can be a bit of a hassle sometimes but what I liked about both that and the legacy BubbleChat system is the amount of control we as developers got over the chat behaviours down to the granular bits of code and seeing everything there, editable and not hidden behind an inaccessible wall.

How do we create non-player TextSources with this new system, is there a way? I can’t see it from a cursory view of the listed API nor the examples. TextChatService ideally should have the same level of features that the Lua Chat System bolstered.

84 Likes

I’ve always had trouble with the lua chat system, this makes it so much easier. Great work Roblox!

Yes, I will finally be able to work on this again!
image

43 Likes

if you enable this then the chat disappears entirely in a live server lol

22 Likes

Roblox is really on the redemption arc! Looks great! Any ETA on when the formal documentation will be released?

13 Likes

Probably because its a beta feature? I think it should turn off the feature in live games though considering it is in beta

12 Likes

This seems sweet, so basically… easier to write custom chat systems and command systems now?

12 Likes

i was expecting the old chat to still be there because this is a beta studio only feature

13 Likes

I’ve noticed that this was in the works for a while and it looked like an incredibly interesting update, I am most curious as to whether or not this will enable Xbox users to finally have the ability to utilize text chat again, seeing as it would appear that the service would forcefully handle all filtering, privacy settings, etc now, which I had heard was the reason text chat was prevented on Xbox.

21 Likes

This is such a great API surface, especially compared to the previous Chat and ChatService modules!

I’m really excited about the new UI as well - it’s a big upgrade compared to the previous one.

11 Likes

This is a great update!

I’m going to be using the new chat in all my games.

Thank you so much for this update!

8 Likes

Are you going to be able to set chat years? For example, instead of having the chat we have right now, we could have chat from 2014, 2013, 2012, 2011 and the rest?

This would be a great feature and I think roblox is going the right direction with this update!

13 Likes

I think that could make the feature more confusing, but someone could probably make a legacy chat theme

8 Likes

After almost 2 years, the chat will finally match the theme with the Topbar!

What I would like to see with the commands is something similar to Discord’s slash commands:


It would probably get admin systems to add Slash Commands to their commands.

Anyways, can’t wait for this to roll out to public servers!

41 Likes

That’d be super cool, they could release it as a plugin too for you to pick which year it is!

8 Likes

Damn, Very cool update on chat. Roblox has been growing and growing to a new level.

7 Likes

I was just going to write a command system (outside of chat) for debugging, but I might actually integrate it into the new chat. It would be really nice if we could see a list of commands as we’re typing it with similar ones, along with the description and parameters, then Roblox could give us each parameter when one is performed. Very promising and clean!

On other notes, I did really like the option to be able to resize the old chat interface on PC since I’ve always liked to enable it when possible since the default scaling usually bugs me. Is there any chance we can see this added back, possibly as a setting? Heck, maybe even if you just have a small invisible dragger to the bottom right, like Windows has for scaling windows. I know we might end up seeing this if it does get added like many of the older settings (as mentioned), but I’m not too sure.

I’d typically complain for it no longer being under PlayerGui since I sometimes use it to customize the interface deeper for settings that may not be provided, like adding rounded corners on the existing one, but I’d likely create my own if it’s that important to me. On the upside, I do enjoy PlayerGui being a bit cleaner by default!

ps: It would be nice if the scaling was clamped past a certain aspect ratio, so it won’t be so extreme on wider viewports - like it does feel a bit too long by default in my studio window.

13 Likes

Chat seems to become super wide on 16:9 displays

21 Likes

Found an issue already!


I have this UI set to overlap the chat, however it isn’t overlapping how I want it to.

LegacyChatService did get overlapped. I know I could just disable chat until the game is loaded, but I would like to see this fixed for games that don’t really get updated anymore.

Edit: Disabling chat didn’t work in my ReplicatedFirst Loading script. What I mean here is that you could still see the chat window.

game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)

-- Visuals for loading screen are here

-- When loaded

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
13 Likes