Hi.

So, I'm trying to make my own admin commands, and I find it rather redundant to say "if msg == 'blablabla' then" for each and every admin command I make. Instead, I find it better just to iterate over a dictionary where its keys are the command strings and they keys' values are the functions to execute.

But, I have no idea how I would execute those functions set as keys. Is there any way?

local cmdModule = require(script.CommandModule)

local cmds = {
	["shutdown"] = cmdModule.shutdown()
}

player.Chatted:Connect(function(msg)
	for i, v in pairs(cmds) do
		if msg == i then
			-- ???
		end
	end
end)