How do I delete a chat message?

I want to delete chat messages when a chat command is sent (not the default chat commands, custom ones made by me) so they dont show up to the player or anyone else, I tried following this guide but it didn’t work, I need help.

Guide that didn’t work: Can I Develop my own Chat Filtering System? Is it allowed? - #9 by colbert2677

You can’t, you can only stop it from sending.

How would I do that then, to stop it from sending?

You can use the Lua Chat System API to register a command.

Im using the same thing as this, but its not, not sending it if it makes sense.

Script:

local util = require(script.Parent:WaitForChild("Util"))

function ProcessMessage(message, ChatWindow, ChatSettings)
	if string.lower(tostring(message)) == "!buy space" or string.lower(tostring(message)) == "!buy speed" or string.lower(tostring(message)) == "!help" then
		return true
	end
	return false
end

return {
	[util.KEY_COMMAND_PROCESSOR_TYPE] = util.COMPLETED_MESSAGE_PROCESSOR,
	[util.KEY_PROCESSOR_FUNCTION] = ProcessMessage
}

theirs a 3 dots on the message and if you click on the dots it give you the option to delete the message then you need to click on it

This is basically the same thing too…?

You should look at the example code for RegisterProcessCommandsFunction in ChatService. The code should be in a server script

The person who made the guide made another post on another post which was not the guide post about putting it in a module script, I thought module scripts are server sided too?

1 Like

By server script I meant a module in ChatModules, not ClientChatModules

Oh?
image

1 Like

You should see the guide to the Lua Chat System before doing anything
In-Experience Text Chat | Roblox Creator Documentation

It still doesnt work?
image

New Script:

function ProcessMessage(message, ChatWindow, ChatSettings)
	if string.lower(tostring(message)) == "!buy space" or string.lower(tostring(message)) == "!buy speed" or string.lower(tostring(message)) == "!help" then
		return true
	end
	return false
end

What am I supposed to read!?
This would take hours to read if I read the entire thing

Read the Server Modules part. It has the most important information about server chat modules. You should also read the ChatService API

I have this so far

local function processMessage(message)
	if string.lower(tostring(message)) == "!buy space" or string.lower(tostring(message)) == "!buy speed" or string.lower(tostring(message)) == "!help" then
		return true
	end
	return false
end

local function runChatModule(ChatService)
	ChatService:RegisterProcessCommandsFunction(processMessage)
end

return runChatModule

In the API it says I need a function id?

It still doesn’t work yet btw.

Function ID should be the name of the function that you are using. You should first put the name and then the function

so (“processMessage”, processMessage)?