Cmdr: A fully extensible and type safe command console for Roblox Developers

Should we use this in 2024? Cmdr isn’t being well-maintained, and, as useful as it is, it’s overly complicated. Just setting it up takes a few minutes of going back-and-forth through the documentation. Why can’t it be simpler?

I think it would be a good idea to create a modern alternative to it. Creating a fork would be too much of a hassle, as it would require re-interpreting the source code. So, maybe build it from the ground up.

6 Likes

Yes

Cmdr is being well maintained

This is the “modern alternative” to a command console.

It was built to be extremely robust. It is made by one of the top programmers on this platform (The same person who created the promise module). It is used by many top games like Jailbreak. The learning curve is slightly steep but it is worth it to just power through it because in the end you will have a very powerful command console that is useful in pretty much any game you make.

I’d argue it’s not.

Don’t get me wrong, Cmdr is cool and all, but it’s pretty much falling behind. It doesn’t even have strict-typing. In 2024.

2 Likes

Oh, well it works well for me. I didn’t see any major issues on the github either.

How would I turn this into a surface GUI and use it as a computer screen?

Why would you want to? is the real question.

So… if it works for you doesn’t mean it does for everyone else

1 Like

wow so profound

So I can make a computer terminal, so players can execute commands on a computer.

@evaera There’s an issue so everytime you press the keybind to open, it does not check GameProcessedEvent so it uses the keybind even if you chat.

Same goes for when you are, for instance writing a ban message or server message, it also closes the panel.

This post was made on September of 2018.
I was wondering since it is 2024 is CMDR still a good “command console/admin” in 2024?
Please let me know with your thoughts politely by replying. :slight_smile:

It most definitely is! Even in 2024, it’s still one of the most customizable command systems out there. I’d daresay there’s nothing else like it.

If anyone else can find anything even remotely similar, I would love to be sent the links so I can check them out myself.

2 Likes

How in the world, do i give people perms to certain commands?

Yes and no, it’s good as a starting point for recoding an admin system that you like and for you, but the source code could be improved and be more “up to date.” Honestly, I would suggest and pull request some new features, but I’ve been blocked from doing that (not explaining why).

1 Like

You’d define the group that can access the command on the client like in this image:

And then when you’ve done that, all you do is check the group the command is a part of in your hook check, and if the player has permission to run the command, you don’t return anything.

Here’s what I did for my hook check as an example:

I’ve had this setup for a while, and it hasn’t failed even once.

1 Like

The group parameter under CommandContext has the “any” type, but says it’s typically defined as a string:

The issue is that the ‘help’ command uses a table.sort method, which requires group to be defined as a string or an integer or else it will error.

I think this should be more clear in the documentation.

1 Like

Is it possible to change CommandContext.Group? If so, how would I do it?
Edit: I used my brain a realized I was doing permissions wrong, it’s literally just a string lol.

How to set this up? i can’t do it

What part are you struggling with? Have you read the tutorial in Cmdr’s website? I’ll summarize the basic setup from their site.

Server:

-- An example from Cmdr's website
-- This is a script you would create in ServerScriptService, for example.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Cmdr = require(path.to.Cmdr)

Cmdr:RegisterDefaultCommands() -- This loads the default set of commands that Cmdr comes with. (Optional)
-- Cmdr:RegisterCommandsIn(script.Parent.CmdrCommands) -- Register commands from your own folder. (Optional)
Cmdr:RegisterHooksIn(path.to.Hooks) -- Register the BeforeRun hook

Client:

-- An example from Cmdr's website
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Cmdr = require(ReplicatedStorage:WaitForChild("CmdrClient"))

-- Configurable, and you can choose multiple keys
Cmdr:SetActivationKeys({ Enum.KeyCode.F2 })

In another folder (in this example CmdrCommands), define the custom command and its behavior.
A ModuleScript named Teleport (or whatever else you want it to be):

-- An example from Cmdr's website
-- Teleport.lua, inside your commands folder as defined above.
return {
	Name = "teleport";
	Aliases = {"tp"};
	Description = "Teleports a player or set of players to one target.";
	Group = "Admin";
	Args = {
		{
			Type = "players";
			Name = "from";
			Description = "The players to teleport";
		},
		{
			Type = "player";
			Name = "to";
			Description = "The player to teleport to"
		}
	};
}

Another ModuleScript, this time named TeleportServer:

-- An example from Cmdr's website
-- TeleportServer.lua

-- These arguments are guaranteed to exist and be correctly typed.
return function (context, fromPlayers, toPlayer)
  if toPlayer.Character and toPlayer:FindFirstChild("HumanoidRootPart") then
    local position = toPlayer.Character.HumanoidRootPart.CFrame

    for _, player in ipairs(fromPlayers) do
      if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
        player.Character.HumanoidRootPart.CFrame = position
      end
    end

    return "Teleported players."
  end

  return "Target player has no character."
end

You will also need to setup a BeforeRun hook, otherwise Cmdr will not run. I will put this inside a folder called Hooks in this example, but you can call it whatever you want

-- An example from Cmdr's website
-- A ModuleScript inside your hooks folder.
return function (registry)
	registry:RegisterHook("BeforeRun", function(context)
		if context.Group == "DefaultAdmin" and context.Executor.UserId ~= game.CreatorId then
			return "You don't have permission to run this command"
		end
	end)
end

And finally, in the same server script where we registered Cmdr’s default commands, register the custom commands and hooks. Here’s how you would do it:

Cmdr:RegisterCommandsIn(script.Parent.CmdrCommands) -- Register commands from your own folder. (Optional)
Cmdr:RegisterHooksIn(path.to.Hooks) -- Register the BeforeRun hook

I wrote this up in like 10 minutes so it might be a bit sloppy but hope this helps!

2 Likes