Making an Admin Console using player.Chatted

Hey there,

I have a small question about player.Chatted function.

How could you make it so once someone types “/admin” in chat, the message doens’t actually get sent. (For example: if you were to type “/console” in the chat, the dev console will open but no message in the chatbox of ROBLOX)

        if msg == "/admin" then

I have this small starter-script which I simply made.

Any help is appreciated.

1 Like

is this what youre looking for??

1 Like

Oh, that can be done by tampering with the Chat system a little bit. It’s easy though.

Step 1: Create a folder called “ClientChatModules” inside the Chat service (Service image below) image

Step 2: Create a folder called “CommandModules” inside the folder you previously created in step 1.

Step 3: add a BoolValue inside the folder you previously created in step 2 and name it “InsertDefaultModules”.

Step 4: Add a ModuleScript inside the folder you created in step 2, and paste this in:

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

local replicatedStorage = game:GetService("ReplicatedStorage")
local adminEvent = replicatedStorage.AdminEvent

local commands = { "your", "command", "names" }

local prefix = "/"

local function ProcessMessage(message, cw)
    if message:sub(1, #prefix) ~= prefix then
        return false

    local args = message:split(" ")
    local cmd = args[1]:sub(#prefix + 1, #args[1]):lower()
    table.remove(args, 1)
    if not table.find(commands, cmd) then
        return false

    adminEvent:FireServer(message, args, cmd)
    return true

return {
    [util.KEY_PROCESSOR_FUNCTION] = ProcessMessage

Step 5: Add a RemoteEvent called “AdminEvent” inside of ReplicatedStorage.

You can handle your admin from a server-sided script by listening to AdminEvent.OnServerEvent. The parameters passed are the Player by default, the message, arguments passed and finally, the command name that the player invoked.

This was something that I did for the admin in my game, feel free to adjust it according to your needs.


Half works for now.

I think my chat broke. Can’t type anything. I’m sure I did everything okay.

Screenshot below, no errors.


Whoops O_o

To add on with that, I got this little error. Maybe this helps you fix it.

Oops, forgot. You need to check the value to true for the BoolValue called “InsertDefaultModules”.

1 Like

Thank you so much! It works! <3