You can support a command with multiple arguments with the following snippet:
TextChatCommand.Triggered:Connect(function(textSource: TextSource, rawText: string)
local words = string.split(rawText, " ") -- words[1] will be the first argument, words[2] the second, etc
-- do the thing!
end)
As @TheRealANDRO said, it was just an example. In reality, if something like this was implemented, there would most likely be a small button for opening the channel bar.
Question about the metadata parameter on a couple methods (DisplaySystemMessage and SendAsync) for TextChannel. What exactly is it, and how would one fill it in?
The metadata is useful for setting some data in JSON(I think) for the message, for example if you want to tag a person you could set the metadata to “vip_tagged” and then you could retrieve it from the OnMessageReceived event.
You can decide to send an optional metadata with a message created by SendAsync or DisplaySystemMessage.
For example, we set the metadata tag for system messages from our “mute” command to either Roblox.Mute.Info.Success or Roblox.Mute.Error.CannotMuteSelf depending on the status of the command. Then our OnIncomingMessage hook for the default RBXSystem channel can color the text of the system message red if it sees Error in the metadata or grey if it sees Info.
You could also do this to attach some additional context to a message sent. For example, if you wanted to make someone’s text larger if they were a giant in your game, you could attach a metadata string with each of their messages sent from SendAsync:
textChannel:SendAsync(text, "isGiant")
textChannel.OnIncomingMessage = function(textChatMessage)
if string.find(textChatMessage.Metadata, "isGiant") then
-- make text bold or something
end
end
Decorating system messages is probably a more common usecase and it can be done the same way:
-- you could read textChatMessage.Metadata to color this text based on the reader's team affiliation
textChannel:DisplaySystemMessage(text, "RoundWon.TeamA")
Liking the look of the new chat system and the general improvements to a few common systems.
Two issues currently preventing us from adopting the new chat system in Club Roblox are:
Need “RegisterChatCallback” or similar to be implemented so that we can monitor and intercept text chat messages from the server. An example of this use case is intercepting messages that we deem to have been sent by bots. (We have a few other important use cases similar to this)
Text box focused event for typing indicators or typing indicators built-in by default for bubble chat.
Looking forward to being able to implement this fully once the above issues have been worked through. Otherwise really excited about the UI refresh and general improvements.
The new chat system looks very cool and modern! I will definitely be using this. However, while I was testing the new chat, I found some problems with the default chat ui.
1. The textbox for the chat bar is much smaller than the visual bar. This is annoying when you are trying to click on the chat if your mouse is too close to the border of the visible bar. 2. When using the “/” shortcut, there is a small but noticeable delay before you can actually start to type. 3. When you go over the maximum character limit, it doesn’t stop you from typing. When you send the message with more than the maximum characters, it just completely deletes your message. 4. When you close and open the chat using the button, the chat will be scrolled up to the top. 5. If you fill up the whole chat so a scroll bar appears, if you type a letter like “g” or “j”, part of the letter will be cut off. 6. The useful chat command “/clear” isn’t a feature. 7. Sometimes the chat messages disappear instead of the chat box when idle from it. (I don’t know what causes this and it only happened twice) 8. The chat box sometimes disappears for being idle even if your mouse is over it. 9. The colon after the player’s name is the same color as the chat instead of the color of the player’s name. This just is slightly confusing and annoying to look at. 10. You can type WAY too many messages before it makes you wait to send more messages.
I really like the new UI! I have a question though:
With the legacy chat, there’s a method for creating chat speakers for non-players. Looking at the new AddUserAsync method, it seems this is no longer possible as you can only create speakers for players that are on the server?
For example, in my game, I have a Pizza Man who drives into the map to give deliveries to players. His messages appear in the chat too because I created a chat speaker for him with the legacy chat. It’s a small thing, but I think it makes him feel a lot more real and also lets players know that their deliveries are here when they’re not near the van.