Private Command Message

So, I’ve been using the HD Admin commands for a while and I want to block any command that is using “:” from being executed in the system channel.

I don’t have experience with chat, but I did code BaseAdmin, so I know a bit about this.

Admin systems look for the Player.Chatted event, not any of the chat events. So, to make it work with chat channels and filter them out, it can do this:

  1. Find the message in the main channel and if it’s there do not execute the command.
  2. Don’t listen for commands using the Player.Chatted event.

I haven’t thought of this too much, but you can also use some of the events in the chat events folder.

However, I cannot understand HD admin source code so I cannot be sure about this. All I know is that you’ll have to fork it to get this working (unless there’s a feature for this I’m not aware of).

So, I don’t know if I’m just dumb but Roblox gave me this error when i join the game.

ChatServiceRunner is not a valid member of ServerScriptService "ServerScriptService"

local serverScriptService = game:GetService("ServerScriptService")
local chatService = require(serverScriptService.ChatServiceRunner.ChatService)

game.Players.PlayerAdded:Connect(function(plr)
	chatService.SaidMessage:Connect(function(msg, name)
		if msg:match("lol") and name == "System" then
			print("ok")
		end
	end)
end)

I think you need to wait for the chat service runner first.

It took so long but I finally got it done. I created a ModuleScript in the ChatModules folder named “CommandScript” and I pasted in the code below:

local function processMessage(speakerName, message, channelName)
	if string.lower(tostring(message)) == "robux" and channelName == "System" then
		print("Filtered.")
		return true
	end
	return false
end

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

return runChatModule

Thank you for helping!

1 Like