Then you can create your own text box to send messages:
local textBox: TextBox = createTextBox()
local chatInputBarConfiguration: ChatInputBarConfiguration = TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration")
textBox.FocusLost:Connect(function(wasEnterPressed: boolean)
local targetChannel = chatInputBarConfiguration.TargetTextChannel
if targetChannel then
targetChannel:SendAsync(textBox.Text)
end
end)
Rendering messages takes a little more work, but you can do that by listening to events like in this pseudo-code:
local chatWindow: Frame = createChatWindow()
TextChatService.MessageReceived:Connect(function(textChatMessage: TextChatMessage)
renderTextLabel(chatWindow, textChatMessage)
end)
For help with something specific like this, feel free to ping me in a new thread in the Help and Feedback section since there will likely have to be some back-and-forth with this request!
Insanely awesome update - I love that Roblox is getting away from forking default scripts and instead allowing for seamless integration. This is a great display of futureproofing, and I’m really excited to see the subsequent updates to this. This provides a really cool flexibility that actually makes subsequent updates (hopefully) roll as “new features/developer options for the chat system” versus “global chat system changes”.
Here’s hoping the Animate script gets some love soon
This update is really nice and I was able to update my public script accordingly without any issues. However, it is still annoying there is no ability to hide a message until I have fully “processed” it as a developer.
Under recommendation from @be_nj in this reply to my controller, I store everything required, such as prefix, name color, and so on, as an attribute to the player. In my script, all I do is read this attribute as a script, as with in this code snippet:
function PlayerMessageHandler:Success(message, properties)
local player: Player = Players:GetPlayerByUserId(message.TextSource.UserId)
if not Util.AssignmentOptions:CheckIsPlayerValid(player) then
return properties
end
local prefixText = player:GetAttribute("ChatData_PrefixText")
local prefixColor = player:GetAttribute("ChatData_PrefixColor")
local nameColor = player:GetAttribute("ChatData_NameColor")
local chatColor = player:GetAttribute("ChatData_ChatColor")
properties.PrefixText = string.format(
Configuration.PlayerMessage.NameFormat,
message.PrefixText
)
if typeof(nameColor) == "string" then
properties.PrefixText = string.format(
Configuration.PlayerMessage.NameColorFormat,
nameColor,
properties.PrefixText
)
end
if typeof(prefixText) == "string" and typeof(prefixColor) == "string" then
properties.PrefixText = string.format(
Configuration.PlayerMessage.PrefixFormat,
prefixColor,
prefixText,
properties.PrefixText
)
end
if typeof(chatColor) == "string" then
properties.Text = string.format(
Configuration.PlayerMessage.TextFormat,
chatColor,
message.Text
)
end
return properties
end
The line Util.AssignmentOptions:CheckIsPlayerValid(player) does not yield as this is all it is:
function AssignmentOptions:CheckIsPlayerValid(player: Player)
return typeof(player) == "Instance" and player:IsDescendantOf(Players)
end
The “delay” can still be seen in this video (ignore the music, I didn’t feel like muting it okay).Edit: The delay is no longer visible thanks to a bug being pointed out by @be_nj in this reply.
Are there any plans to add the ability to hide a message? Since it’s a UIListLayout, even the ability to make the TextLabel.Visible to false would be nice, however, we don’t even have that small amount of control.
It sounds like both of these ideas are converging on the same thought! Being able to hide particular messages with the default UI is something we are considering through the TextChatMessageProperties API.
Right now there is not a way to hide messages within the default UI. Of course you can decide to hide or filter messages based on proximity or TextChatMessageStatus with a custom UI but we’d like to enable this in the default case as well.
How do channels work? When this was in beta I could not see a way to have elective always-available channels that players could switch between on the fly (e.g. general versus roleplay-specific chat) because there was no documentation. Still cannot find anything of the sort. Was this feature dropped? I guess I can allow players to form chat groups (custom channels), but there’s no nice way to present this within the UI of the chat window, or to allow them to swap channels in a self-contained way. If there is I couldn’t figure it out.
Also it seems there’s no way to let players resize this chat? This is important in my game because roleplay involves a lot of chat history.
It’s great to see the new in-experience text chat system and new UI looks much better and the fact you get more customization with it. Good job and well done to everyone who worked on this new in-experience text chat system. I will definitely find some time to check out the documentation. Thank you for this release!
Currently the default UI will only send messages to TextChannels based on what is currently ChatInputBarConfiguration’s TargetTextChannel property. Developers can write to this property to change where users messages go.
For example, you could create a custom TextChatCommand to switch to a different channel by overwriting this property. These chat use cases are more complex and we are still researching the best ways to support these flows in the long term. Do you have a link to a game that features heavy channel switching? We can use it as a case study to see how users are used to channel switching like this!
While I suspect a large amount of users actually use whisper chat for roleplay between two people, for larger groups you can sometimes find users in servers using the roleplay channel for their roleplay business. I think you’ll have a hard time finding that needle in a haystack in my game because it’s relatively small and I’m still working on roleplay capabilities, but it does happen from time to time and I do foresee it increasing as I improve the state of affairs. Be an Alien: Renewal - Roblox
A better solution for my needs would be a tidy way to let players have shared whisper chats, but as it stands the new chat doesn’t really make it possible to have a cohesive interface for all this (can’t even switch channels within the chat window…), so it would be a downgrade.
I don’t remember if this chat supports whisper yet either?
This chat supports whisper chat. It should be pretty identical to before. Would a group whisper chat feature be something that would solve some of your needs out of the box?
We’re also interested in opening up some basic hooks into the default UI to help facilitate more complicated use cases.
A group whisper would mostly eliminate my need for roleplay chat. It would make it harder for people to join roleplays on the fly but I think players can work it out. Not sure the details of how it would work with respect to joining/leaving/managing a group chat though.
UI hooks would be amazing. I would like to add an expand button if there is no resize functionality so players can make the chat larger vertically up to some limit. Channel tabs are also sorely missed, especially if there will be group chats. Switching would be a pain if you needed to use an external button or command all the time.
To send a system message, you can use TextChannel:DisplaySystemMessage(message) instead.
If youre using the default text channels, you can reuse the RBXSystem channel for this:
local systemChannel = TextChatService:FindFirstChild("RBXSystem", true)
if systemChannel then
systemChannel:DisplaySystemMessage("MESSAGE")
end
but in reality, any TextChannel – even one you created manually – should work as long as there are TextSources listening to it.