If I were to script spoken commands, is it a good option have it all processed on the server?

Would it be a viable option to have all commands of say, an admin commands module, processed on the server, rather than on the client?

The only thing i’d plan on doing on the client is decide who the victim is. Otherwise, player.Chatted and all other functions would be done on the server.

Is this a good or bad idea, and why is it good/bad in your opinion?

1 Like

Use the Lua Chat’s helpful FunctionProcessor feature, this allows you to handle commands, see which channel it is, and who send it. Aswell as making it invisible
(to answer your question, do it on the server)

Main Article: Lua Chat System

A function processor allows you to handle user input without it actually displaying in chat

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

--taken from the wiki page
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 --stops the message from drawing into the chat
	end
	return false --draw the message in the chat
end
 
ChatService:RegisterProcessCommandsFunction("createPart", createPart) --create the processfunction with a Unique Identifier

The function should return true/false, this signals if the message should continued being processed, or in simpler terms, if it should be drawn to the chat window or not

Remember that you get the Speaker’s and Channel’s NAME, not the speaker or the channel themselves, you get these with ChatService:GetSpeaker() and ChatService:GetChannel() respectively

3 Likes

Thanks so much for the advice and the function!