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

Thank you so much @metatablecatmaid

I hate working with API that doesn’t have documentation.

1 Like

For some reason, the following code causes studio to close:

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")

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

	local ChatTags = game:GetService("ReplicatedStorage"):WaitForChild("Functions"):WaitForChild("ChatTags"):InvokeServer() 
	
	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		local StringTagTable = {}
		local TagTable = ChatTags[player.UserId]
		for _, Tag in ipairs(TagTable) do
			table.insert(StringTagTable, "<font color='"..Tag.TagColor:ToHex().."'>["..Tag.TagText.."]</font>")
		end
		props.PrefixText = table.concat(StringTagTable, " ").." " .. message.PrefixText
	end

	return props	
end

Edit: Fixed it by waiting for the function before the event, however I find it strange that waitforchild would cause studio to crash.

1 Like

No, Pre-2012 chat was done in C++ not Lua, but there’s 3rd party ways to do this.

3 Likes

I like the idea for the CSV List

1 Like

A few bugs that I found:

  • The chat automatically opens upon joining, but will still show the notification in the icon when a message is sent unless you click it again.
  • When clicking ‘/’, the chat won’t open. You can only open it up if you click on the chat icon.

I forgot to mention this yesterday, but I just released a script to aid with adding prefixes and name colors to chat. NewChatController - Resources / Community Resources - DevForum | Roblox
image

I don’t think @ericplane posted theirs here, so I’ll include it as an additional resource:
TextChat+ v1.1 - A new way to manage TextChatService Tags - Resources / Community Resources - DevForum | Roblox
image

4 Likes

The chat covers up half of my monitor, is it possible that it could be resized?

3 Likes

This is life changing for admin commands!

1 Like

Can we make these commands but only admins of the experience can use them? (Admin Commands)

Yes, you just need to check the TextSource.UserId when it’s triggered.

Roblox has been cranking out these amazing updates recently, I’m really excited for the future.

The UI looks amazing and this seems much easier to work with!
Can’t wait for this to roll out into live servers!

1 Like

Was a custom chat system I was working on a long time ago, but I could never figure out how to get it to work or if it could work with lua chat system, so I never finished it

5 Likes

Nice to see Roblox making existing systems easier to use for new developers!
Can’t wait to try this out!

1 Like

This is a great update! Thank you very much!

1 Like

There’s no need for a betttaaaa! C’mon Roblox… let us use it in our games now :wink:

1 Like

Very interesting, just a quick question on your demo.
I’ve never seen this before

function(message: TextChatMessage)

what does it do?

1 Like

Also, disabling “ChatInputBarConfiguration” does not remove the chat bar.

https://gyazo.com/6325541a6a24b560501d380e02881c82

1 Like

This is a part of Roblox’s LuaU type checking.

That is just declaring that the message parameter is of type TextChatMessage.

2 Likes

I have two pieces of feedback atm, both based off this image:

  1. The TextChatMessageStatus Enum seems to be missing Enum.TextChatMessageStatus.Sending in its documentation.

  2. When a message is in Sending state, it still appears in chat. This is unlike the old chat system where it would “process” the message first (in this case, that would be using TextChatService.OnIncomingMessage) and THEN shows the message once the formatting and coloring is done. This is an issue because, since I am doing a lot of checks to see what the player’s prefix, name color, and chat color should be, it takes a few more ms than is in a single frame and therefore is put into the Sending state. In chat, it displays plain (I am adding the [] myself) before “switching” to the formatted version given through the properties.

In Sending:
image
In Success:
image

It is very inconvenient and looks awkward/horrendous. It takes this much time in the current chat system, but players don’t see that because it doesn’t show the message until it’s done. The fact that I have enough time to take a screenshot proves that.

Yes, I can optimize it on my end more by caching stuff and just overall code quality. HOWEVER, not everyone wants to make the sacrifices related to caching when it comes to dynamic changes in prefixes and name colors. Plus, newer developers don’t know much about caching and if they are making their own systems based off this, it will have that awkward feel to it.

1 Like

We wanted to have the chat feel responsive to players when used. However if you do not have all the information ready to format your player’s messages, it does come with this caveat.

It doesn’t look like it made this release, however we have plans to allow developers to filter out which messages appear in the ChatWindow from OnIncomingMessage. This would allow developers to filter out system messages that are not relevant (example use case: How can I disable team changed system message?) or in your case, you would be able to optionally hide any messages with the Enum.TextChatMessageStatus.Sending value.

Would something like that solve your problem?

5 Likes