So basically I’ve created a script that plays a custom emote when you type in a certain command, like “/e dance4”, but every single time I do it and playtest, Roblox gives me this error in chat :
when I actually switch to R15 it gives me this :
Doing any other command containing “/e” will always get the same result. If I try to do something that doesn’t contain “/e” it’ll just become a regular chat message. Other games have commands like that but they don’t get that error so I’m confused
Here is my code if it helps :
Incredible necroposting from my side, but I’ve found a solution.
Since TextChatService started existing, it has some incredibly useful callbacks, one of which is OnChatWindowAdded, which we’re gonna use to (almost completely) erase every emote error message.
Since OnChatWindowAdded fires RIGHT before a message in the chat window shows up, we can use it to find out whether or not the message has come from the built-in emote system. Luckily, Roblox gave us a sign to know, and that is by the TextChatMessage’s Metadata property, which is, in the case of the “Switch to your R15 avatar” message, will be equal to “Roblox.Emote.Error.SwitchToR15”.
To detect whether or not this is, in general, a Roblox emote error, something like message.Metadata:sub(1, 12) == "Roblox.Emote" should be enough.
By getting the message properties from :DeriveNewMessageProperties(), we can use it’s “Text” property to reduce the size of the text to 0, which will make the text disappear, and that is by using some Rich Text trickery.
By setting the ChatWindowMessageProperties’s “Text” property to “<font size="0">”, it will effectively remove the error text, therefore solving this one hell of a persistent error.
In the end, the script should look something like this:
local textchatservice = game:GetService("TextChatService")
local chatwindowconfiguration = textchatservice.ChatWindowConfiguration
function OnChatWindowAdded(message: TextChatMessage)
local properties = chatwindowconfiguration:DeriveNewMessageProperties()
if message.Metadata:sub(1, 12) == "Roblox.Emote" then
properties.Text = "<font size=\"0\"></font>"
return properties
end
end
textchatservice.OnChatWindowAdded = OnChatWindowAdded
The script should be put in a LocalScript under the StarterPlayerScripts.
You’re welcome!