Yes, there is actually. The beauty of the Lua Chat System and it’s extensive customisation options is quite amazing. Here’s a relink to documentation if you need it:
I don’t recommend blocking out chats without also telling the user why the chat was blocked or that it was in the first place, which is what the hashtags are meant to do. In the end it’s your structure though and I’m offering an unasked opinion.
What you’re going to need to do is create a CommandModule. This is something that will be registered with the ChatService as something to run when a message is sent. First things first; we need our folder. In the Chat service (should appear near the bottom of your Studio Explorer), add a Folder called ClientChatModules. In it, add one called CommandModules. For good measure, add a BoolValue in CommandModules named InsertDefaultModules and check it off.
Inside CommandModules, make a new ModuleScript. Call it whatever you want then open it up. You will need the following boilerplate code when working with a CommandModule:
local util = require(script.Parent:WaitForChild("Util"))
function ProcessMessage(message, ChatWindow, ChatSettings)
end
return {
[util.KEY_COMMAND_PROCESSOR_TYPE] = util.COMPLETED_MESSAGE_PROCESSOR,
[util.KEY_PROCESSOR_FUNCTION] = ProcessMessage
}
This boilerplate code is for when a message is completed and should be processed. The code you’re going to write is under the ProcessMessage function. It is a callback, meaning it needs to return something. If the function returns true, the message will stop being processed and the server won’t receive the message to display in the chat. If it returns false, the message will go through.
From this, all we need to do is find a hashtag in our string. If one is found, return true to prevent the message from being sent. Return false as a defaulted value as there will be nothing left to get checked, so we can also assume it failed all checks and thus should be treated as a normal message and sent through.
function ProcessMessage(message, ChatWindow, ChatSettings)
if string.find(message, "#") then
return true
end
return false
end
Just like that.