so i am making commands and i want it if i type / then it wont end up in chat is there any way to do that? so like if i know that it starts with a / how do i disable it from being chatted?
how to filter chat im using commands and i need the chat to filter it?
3 answers
You can start by following this article: https://developer.roblox.com/en-us/articles/Lua-Chat-System
Basically you need to copy all the contents of chat when playtesting the game, stopping the playtest and then pasting the stuff into the empty chat. Then set the scriptable proprrty of chat to true. You can then follow the instructions in the article to create the script you want.
.
local function Run(ChatService)
local function createPart(speakerName, message, channelName)
if string.sub(message, 1, 5) == "/part" then
local newPart = Instance.new("Part")
newPart.Parent = game.Workspace
return true
end
return false
end
ChatService:RegisterProcessCommandsFunction("createPart", createPart)
end
return Run
as you can see, we create a modulescript, and put it into the chatmodules folder. in the module we have a function called run, and do stuff in the function. we then create a function in the function called create part, which takes in the message, player who chatted it, and the channel or where its been chat. we then get the message and string.sub ("/part",1,5), which checks if the first five characters (1,5) is /part.
If it is, we then create a part, and return true. After that is the end of the function create part.
After declaring the function create part, we have to pass it through the event ChatService:RegisterProcessCommandsFunction.
Hope this helps!
U could try making a seperate admin panel, that only takes commands.
1 comment
U wouldnt be able to use the chatted event tho
I don't know if this helps but i found someone asking aproximately the same thing on the roblox dev forum. This is the link to it!
https://devforum.roblox.com/t/how-do-i-make-certain-messages-not-show-up-in-chat/104828/6
Hopefully it will help you! :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
is this in a server script? and i dont see where it mutes the player
also where do u put it?
and how does the function get the speakername,message, and channel name?
you put the script into the chatmodules folder. It is a module script. The function gets the speakername, message, and channel name because of the chat function we connected the create part function to. see line 11, ChatService:RegisterProcessCommandsFunction("createPart", createPart) the seond
when i paste the chat into the chat and disable LoadDefaltChat non of the chat is there :/ is that normal?
so i just made it so load defalt chat is true
so it works but in my thing it has an error when i put my code in, it seems that you cant really use remote events in module scripts is there any way around this because what i do with it is i make a system message to all / the person who did the command
im not really sure, ive never done chat command filtering before. maybe you could try using bindable events and fire that and have another script listen to the bindable event and then fire the remote event?
ok thanks ill post a different question about it