Thank you so much @metatablecatmaid
I hate working with API that doesn’t have documentation.
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.
No, Pre-2012 chat was done in C++ not Lua, but there’s 3rd party ways to do this.
I like the idea for the CSV List
A few bugs that I found:
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
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
The chat covers up half of my monitor, is it possible that it could be resized?
This is life changing for admin commands!
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!
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
Nice to see Roblox making existing systems easier to use for new developers!
Can’t wait to try this out!
This is a great update! Thank you very much!
There’s no need for a betttaaaa! C’mon Roblox… let us use it in our games now
Very interesting, just a quick question on your demo.
I’ve never seen this before
function(message: TextChatMessage)
what does it do?
Also, disabling “ChatInputBarConfiguration” does not remove the chat bar.
This is a part of Roblox’s LuaU type checking.
That is just declaring that the message
parameter is of type TextChatMessage
.
I have two pieces of feedback atm, both based off this image:
The TextChatMessageStatus
Enum seems to be missing Enum.TextChatMessageStatus.Sending
in its documentation.
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
:
In Success
:
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.
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?