Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I delete a message from the chat?

Asked by
asadefa 55
4 years ago

I am trying to make an antiscam filter that looks for things like Player.Username.."just got TONS of ROBUX using", kick them from the server, and then deletes the message. This might be more complicated because of the /me part, but how can I delete the message from the chat to reduce the chance of people falling for it.

0
hmmm... I always wanted to know how to do that too. Great idea for the anti-scam filter WyattagumsBackUp 5 — 4y
0
Yes totes agree! asadefa 55 — 4y
0
/me commands are now disabled by default. https://devforum.roblox.com/t/in-game-chat-me/280889 M39a9am3R 3210 — 4y

1 answer

Log in to vote
0
Answered by 3 years ago

I believe I know the answer! The answer comes from https://developer.roblox.com/en-us/articles/Lua-Chat-System Insert A ModuleScript Inside of Util's parent (I have no idea)

Replace the source of the ModuleScript with:

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

function ProcessMessage(message, ChatWindow, ChatSettings)
    if string.sub(message, 1, 5) == "/last" then
        local currentChannel = ChatWindow:GetCurrentChannel()
        if (currentChannel) then
            currentChannel:RemoveLastMessageFromChannel()
        end
        return true
    end
    return false
end

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

It's my first time messing around with the Lua Chat System so yeah.

Ad

Answer this question