How to detect if a message was added to the chat box

My goal is to know when users chat messages that aren’t loaded in the chat box. For example, when you say “/e dance”, it’s not added to the chat box but obviously still calls Player.Chatted. How would I do this?

Well, I’m not sure myself the functionality of .Chatted, but if you’re saying it invokes that event, why not just listen to it?

You also should consider looking to the Animate script in the character, pretty sure it does some things related to /e dance in there.

1 Like

.Chatted is called whenever a player sends a chat. It’s unfiltered, and still goes through even if its a default Roblox command such as “/console”. I don’t want it to appear when a player uses a default command.

1 Like

You’re saying you don’t want the .Chatted event to be invoked when the player uses a command like that? Well, I hate to break it to you, but that would be impossible. You cannot change the condition under whether an event fires. Like making .Touched invoke even when a BaseParts CanCollide and CanTouch values are false.

The only way I see is checking the message they sent, whether it’s a command or a normal chat and just not executing the function if it’s a command.

1 Like

I’m not saying that at all. I’m saying I want to know when it is a command. I’m aware you can’t change when the events are called

1 Like

Like, is there any core module that detects when the message is a command? I’m sure there is and I want to know what it is

Use TextChatService and TextChatCommands.
See TextChatCommand | Documentation - Roblox Creator Hub

Use TextChatCommand.Triggered to connect when any player specifically uses a command.

1 Like

I’m using the legacy chat system and I don’t wish to use TextChatService for this game

Look into this:

Ignore, old post.

Try this:
How to hide certain chat messages? - #3 by metatablecatmaid

Instead of just blocking the words, implement your command(s)

I don’t use my own commands, I want to be able to filter messages that use the default commands.

So you just want to know when players use /e dance, /mute, etc?

1 Like

What you’re saying doesn’t make sense to me, in the original post, you stated you wanted to know when users chatted messages that were commands, but you can use .Chatted to do this. It’s even done in line 757 in the Animate script.

That script only checks if you say “/e”. I want to detect if you are using any command, or if it just showed up in the chat in general.

Yes, I want a list of those default commands/and or a module that has them

If this is not the answer to your question I appologize, but if it is than I must suggest that you utilize google to its furthest extent before posting a question topic…

If this doesn’t help, you need to be more clear as to what you are needing help with.

/w
/whisper
%
(TEAM)
/t
/team
/a
/all
/s
/say
/e
/emote
/?
/help
/block

Source: https://github.com/Roblox/Core-Scripts/blob/425d2d641bdc4b6c1104a9d5f6c53c9ea758c5cb/CoreScriptsRoot/Modules/Chat.lua

2 Likes

You can still say those commands by themselves in the Roblox chat bar and they will still appear, but I suppose that will do. I had seen that post earlier and was a little confused on how the text was formatted, and also didn’t necessarily want to check if it was just a command, but if it appeared at all.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.