Woah! How did you add those cool profile pictures?
Can we all agree that Roblox just comes out with the best studio betas?
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!
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:
- 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
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?