New Roblox Chat System Developer Beta


#1

Over the next few months, we will be looking into overhauling the current chat system by adding new functionality, updating the UI, and exposing the underlying systems more to developers. Today, I’m here to release a beta version of this new chat script for the members of the developer forums to test and play around with as they please.

Please do note however, this is not the final product and could potentially change before the final release. Not all features may work as expected (mainly client sided ones).

tl;dr: New really cool chat stuff. Links to try it out at the bottom.


##Main Features

  • New API!
    Chat channels, chat bots, speaking permissions, custom data setting, etc.

  • New updated UI!

  • Entirely implemented in Lua!

  • Installs like ControlScript and CameraScript!
    We wanted this system to be able to be modified like the current ControlScript and CameraScript, so developers could tweak it to their exact liking. For more details, see the installation section.


##Installation / How It Works
There are three components to this new chat system. The server side, the client side, and the chat modules. During runtime, three objects are created and inserted into various places in the datamodel unless pre-existing objects with their specified names are present. This is just like how the ControlScript and CameraScript work.

These objects are:
1. ChatServiceRunner, a Script that will be parented to ServerScriptService.
2. ChatModules, a Folder that will be parented to ServerStorage.
3. ChatScript, a LocalScript that will be parented to StarterPlayerScripts in StarterPlayer.

In addition, ChatServiceRunner will create a folder called ChatEvents to be parented to ReplicatedStorage for RemoteEvent/RemoteFunction communications across client and server.


##Documentation
###ChatService
This is the main singleton object that runs the server sided chat service. It manages both ChatChannels and Speakers.

Methods
ChatChannel AddChannel(string channelName)
void RemoveChannel(string channelName)
ChatChannel GetChannel(string channelName)

Speaker AddSpeaker(string speakerName)
void RemoveSpeaker(string speakerName)
Speaker GetSpeaker(string speakerName)

string[] GetChannelList()
string[] GetAutoJoinChannelList()

void RegisterFilterMessageFunction(string functionId, function func)
void UnregisterFilterMessageFunction(string functionId)
void RegisterProcessCommandsFunction(string functionId, function func)
void UnregisterProcessCommandsFunction(string functionId)
Events
ChannelAdded(string channelName)
ChannelRemoved(string channelName)
SpeakerAdded(string speakerName)
SpeakerRemoved(string speakerName)

###ChatChannel
A ChatChannel is an object that stores data about a single channel that Speakers can chat in. The ChatChannel manages a list of Speakers currently in the channel for relaying messages between them, and also comes with some access permission properties.

Properties
string Name (read-only)
string WelcomeMessage

bool Joinable
bool Leavable
bool AutoJoin
bool Private
Methods
void RegisterFilterMessageFunction(string functionId, function func)
void UnregisterFilterMessageFunction(string functionId)
void RegisterProcessCommandsFunction(string functionId, function func)
void UnregisterProcessCommandsFunction(string functionId)

void KickSpeaker(string speakerName, string reason)
void MuteSpeaker(string speakerName, string reason, int length)
void UnmuteSpeaker(string speakerName)
bool IsSpeakerMuted(string speakerName)

string[] GetSpeakerList()

void SendSystemMessage(string message)
Events
MessagePosted(string fromSpeaker, string message)
SpeakerJoined(string speakerName)
SpeakerLeft(string speakerName)
SpeakerMuted(string speakerName, string reason, int length)
SpeakerUnmuted(string speakerName)

###Speaker
A Speaker object is a representation of one entity that can speak in a ChatChannel. A Speaker can be a Player, or it can be a chat bot that is run and managed by code.

Properties
string Name (read-only)
Methods
void SayMessage(string message, string channelName)

void JoinChannel(string channelName)
void LeaveChannel(string channelName)

string[] GetChannelList()
bool IsInChannel(string channelName)

void SendMessage(string fromSpeaker, string channel, string message)
void SendSystemMessage(string message, string channel)

Player GetPlayerObject() (returns nil for non-player speakers)

void SetExtraData(string key, Variant data)
Variant GetExtraData(string key)
Events
SaidMessage(string message, string channelName)
ReceivedMessage(string fromSpeaker, string channel, string message)
ReceivedSystemMessage(string message, string channel)
ChannelJoined(string channelName, string channelWelcomeMessage)
ChannelLeft(string channelName)
Muted(string channelName, string reason, int length)
Unmuted(string channelName)
ExtraDataUpdated(string key, Variant value)

##All About Chat Modules
Chat Modules are a system in designed to have code interface with the server sided ChatService without having to directly modify the code internally. At runtime, ChatServiceRunner looks through all the children of the ChatModules folder, and for every child that is a ModuleScript, it requires them. These modules are expected to return a single function (not a function call) that will be passed a reference to ChatService for those modules to call methods on. In addition, any child that is later added to this folder during runtime after the initial parse of children will be processed in this way as well.

The idea of implementing chat modules this way, is that developers will not need to overwrite ChatServiceRunner in their game, and updates will be able to be pushed to it when necessary instead of having to let developers know so they can download the new version and then make the appropriate changes to it again to make it work in the way they want it to. Of course, if developers want to create some radically different ChatServiceRunner and ChatService for their game, there is nothing stopping them from doing so and I would not discourage it. ChatModules are to be thought of as Add-Ons to the current system whereas overwriting ChatServiceRunner would be creating your own.

Also, be sure to check out the default chat modules as examples of how to make your own.


##Client Sided Chat Window
The client sided chat window is designed for developers to be able to overwrite and create their own custom look. The main point of interest is the ModuleScript called MessageLabelCreator, where all the logic for parsing text messages into a collection of GuiObjects exist. Developers can easily change the logic in this module to get some pretty cool effects such as buttons in messages that could be clicked to initiate trades with a player, special clan or VIP tags for speakers, color changing text, etc.


##Downloads
Since this is just a developer forum early access test release, this system will not automatically install into places, and you’ll have to insert it yourself. When it goes live, all places will start to have these scripts created in them if they are not found already.

You can find an uncopylocked test place here.
You can download a model file here: NewChat.rbxmx (142.1 KB)
Or you can download a test place file here: New Chat Demo Place.rbxl (53.1 KB)


##Known Issues

  • Channel tab names aren’t shortened properly with trailing …'s.
  • Chat window doesn’t respect Bubble Chat only settings. (Non issue for this release however)
  • Clicking on a player’s name to private message currently does nothing.
  • Spam filter / flood check is non-existent.

In addition, some debug text is left in the code, which may be confusing if you go reading through all of it.


Please remember to leave feedback about your experience using this new system. The main reason for this release is to get community feedback on things you liked, things you didn’t like, features you want built in, and anything else really.

Please try to create cool things with it and let us know about any frustrating aspects of doing so. We want to make this system as accessible and easy to use as possible.


New Chat System Now Live!
Anyone else having problems with the new chat?
#2

Woah, looks incredible!


#3

This is more API than I could have wished for, wow.


#4

Great work! I think maybe newline characters should be stripped out…

Edit: I also suggest that /help work in addition to /?


#5

Yeah, definitely something I forgot about since the only testing I’ve really done is by myself.
Ooops.


#6

Looks like “/team hello” and “/w xsitsu hello” do not work

Also inside the “team” tab. It’d be nice to have some sort of indication of what team I’m on, and what color the team is.


#7

I had sworn that the new chat properly limited chat logs to a reasonable number, but it seems that limiting isn’t working and so I just had my chat overflow in game from too many messages.
Ooops!


#8

Looking good!

Making the fade in/out time take 0.2 seconds instead of 1 will make your UI feel more responsive. It sorta feels laggy right now because it fades in and out so slow.

Here are some errors:

It would be awesome of /me used italic text

/me dances
Quenty dances

Ctrl + 1/2/3/4 to switch channels would be awesome.

Holding shift to do multi-line input would be awesome.

Likewise, when you have multi-line input, making that tween time on that multi-line input to be 0.2 seconds instead of 1 would make it feel much snappier.


#9

This is cool!


#10

Chat scrolling broke and is stuck, scrollbar is gone and I can’t see new chats ):


#11

Because chat log limiting didn’t work and the ScrollingFrame overflowed.
I could’ve sworn that feature was properly working too.


#12

Chat is overlapping for some reason:

It looks like the chat isn’t calculating the width of names correctly and is starting at the very beginning of the name? Was fixed when I rejoined.


#13


#14

Yes we found the emojis!


#15

Emojis should be disabled by default. They’re really only used for spam/trolling/instigating, and if someone wants to make a face they can do it with text.


#16

They were actually never supposed to be enabled. I was messing around one day and put them in and I guess I forgot to take them out.


#17

Same here now


#18

Is it possible for a user to create a private channel with their friends?

Also, suggestion: drag around tabs in channel list to reorder them


#19

I’m looking forward into exploring the APIs of this!

Some (stupid) questions:
If people are able to start private chats, could we possibly have a toggle for this in the game (as this could ruin some gameplay whereas Whisper doesn’t imho as that is a player to another player).

With VIP tags, do you mean like [VIP] [Player] [Moderator] ? Or would we be able to do like [VIP Player Moderator]? Could we assign different colours to them?


#20

Everything changed when the fire nation attacked…