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

Woah! How did you add those cool profile pictures?

3 Likes

Can we all agree that Roblox just comes out with the best studio betas?

6 Likes

This is amazing! I am very excited to see Roblox supporting more intuitive ways to use chat commands! It is also such a relief knowing that all the policy stuff will be taken care of for us. No more worrying if we forgot to filter a chat message! It’s always nice when we get more customizability to core Roblox systems without having to fork the entire thing.

I remember a few months ago I wanted to do some minor edits to the chat system but realized I would have to fork the entire chat system so just gave up. This update makes everything so much easier and makes me excited to see more updates in the future to the chat system!

You can use TextChannel:DisplaySystemMessage instead now:

message.TextChannel:DisplaySystemMessage("Message sent successfully!", "Custom.Test.Info")

local textchatservice = game:GetService("TextChatService")

textchatservice.OnIncomingMessage = function(message)
    if message.Status == Enum.TextChatMessageStatus.Success then
        if message.TextSource then
            message.TextChannel:DisplaySystemMessage("Message sent successfully!", "Custom.Test.Info")
        else
            -- Probably a system message
            if string.find(message.Metadata, "Info") then
                -- set TextChatMessageProperties and return with font choice

            end
        end
    end
end

Also had your previous code worked, you would have set up an infinite loop, so be careful. The code above avoids the infinity loop by checking for TextSource.

Normally I think best practice would be to avoid creating more messages within the callback and use the callback strictly for formatting messages by reading the message properties.

I like how OnIncomingMessage helps encapsulate all the formatting logic for fonts and text styles now instead of having it at each callsite in the game!

3 Likes

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