Currently the only way to remove TextChatService messages on the client is by using OnIncomingMessage and returning a TextChatMessageProperties instance with it’s Text field set to " ". This works “fine” yet has one issue attached to it, despite the message being entirely removed (and the rest of TextChatService noticing the change; not rendering the message, etc.) the notification badge still appears for the deleted message, giving the user the false impression that they have a message to view in the chat which is simply not the case as such message was deleted!
“Player opens chat confused, there is no chat message in-sight because the message was deleted on their client!”
Reproduction steps:
Have an experience that contains multiple Teams (not necessary for the bug although the code sample provided was designed to allocate for it since it is the easiest way to send a chat message when a player is not focussed on chat. In reality, this bug occurs for all messages that are removed on the client and which are sent when the player is not focussed on chat)
Input the following code into a LocalScript:
local properties = Instance.new("TextChatMessageProperties")
properties.Text = " "
game:GetService("TextChatService").OnIncomingMessage = function(msg : TextChatMessage)
if msg.Metadata == "Roblox.Team.Success.NowInTeam" then
return properties
else
return nil
end
end
OR
Just open this Roblox place that conveniently has this all set up already. Repro.rbxl (45.3 KB)
Attempt to change the player’s team while the player has their chat closed (IE: any state in-where the notification badge would appear if a message were to be sent)
Observe that the user has a notification-icon visible on the chat topbar icon; then toggle-open chat, notice that no attached message is visible since it was removed via our localscript, yet the notification still remains!
Expected behavior
I expect no notification icon to be shown for the removed message, as the message is not visible to the player anymore!
Is there really no other way to prevent messages from being sent? This " " thing seems janky. I thought returning nil meant the message was not delivered, but after testing what you said to see if you were right, indeed the message goes through unmutated.
It seems to me like TextChannel.ShouldDeliverCallback, which only works on the server, would make sense to exist on the client too. It could serve as a more explicit way of sinking incoming messages like changed-team or friend-joined messages, along with other scripts that may push chat messages.
This is still an issue. How has this not been resolved? I do find it pretty disruptive as I would like to make sure that some messages aren’t sent (like the Roblox.Team.Success.NowInTeam message in OP’s original post)
I’m trying to set up bubble chat only and have the main chat window disabled and its driving me crazy how the numbers show up for messages you cant see
Hey, apologies for the delay. We are looking into solving this issue holistically through an API change.
We think the current method of using OnIncomingMessage to replace it with an empty string is a bit obtuse and not intuitive.
Instead we are exploring making TextChannel.ShouldDeliverCallback useful on the client for incoming messages to address the usecase for system messages.
-- If we take the above example of hiding the default system message
-- when joining a Team, we can refactor it ShouldDeliverCallback and it’s intention will be more clear:
RBXSystem.ShouldDeliverCallback = function(msg : TextChatMessage)
if msg.Metadata == "Roblox.Team.Success.NowInTeam" then
return false
else
return true
end
end
No promise on an ETA yet due to engine release cycles being unpredictable at times, though we wanted to reach out to acknowledge this is still on our radar.