Feedback on my admin commands (don't know name)

Hello!

I am working on admin commands, I felt like it was time to get feedback! Here is the code in a baseplate!
(The “;cmds” wont work because I have not put the admin gui in.)
Baseplate.rbxl (19.2 KB)
The script is serverScriptService! Thanks!
Edit:
game link: Happle Admin Hangout - Roblox

3 Likes

Could you make it into a game then rather making use download it.

What do you mean??? (30 characters)

I believe they meant opening up a game instance on roblox.com rather to making us download the rbxm file to test your system.

Here! The game!

I will add cmds to it aswell. (30 characters)

Ban works I cant rejoin so that is good!

Thank you ALL for testing my admin and giving feedback!

My feedback:

General Feedbcak:
The Admin Commands are functional and work well. Although they are lacking some key features, this is A beta script so that is understandable. Looking at the Open-Sourced script it is written quite well and is not to performance heavy. :+1:

Positives:

  • The script is well written and does its job
  • The script uses prefixes
  • Most necessary components for A basic script work.
  • Adding admins is as easier as copy and pasting
  • Temp Admin is only temporary
  • The kill feature is smooth
  • Bans are “datastored” and sever wide
  • Commands work consistently with minimal exceptions
  • The script has capabilities to make people immune to bans

Things to improve:

  • Perm Admin cannot be done through command
  • Bans are not yet global
  • Some intended commands such as fling are not implemented
  • Occasional useful commands such as view do not exist
  • Full names must be typed
  • Multiple people/commands cannot be executed at once.

I would five this system 7/10!
:laughing:

1 Like

Thank you so much for feedback! I will try to add these things, thank you!

EVERYONE! You have to be in my server so I can admin you!

Sorry about the people who thought it was wrong, seriously, I have to admin you.

Ok so I have a few bits of feedback regarding your admin. I saw the script, and the indentation is messed up. Also, I think it’d be a better idea to have a modular structure for your system. Perhaps an individual module for commands? It’s also nice to have a command be a table, instead of just a function. Something like:

test = {
    name = "test";
    description = "This is a test command";
    arguments = {"Message"};
    run = function(self, speaker, aruments)
       print(arguments[1]) 
   end
}

For the arguments variable, you can just do something like this:

local arguments = string.split(message, " ")
local command = commandData[1]
arguments = select(2, unpack(arguments))

I’ll also recommend passing a library as a parameter to the command, with functions such as getTargets, getRank, setRank, etc, which will allow it to interact with the system.

I recommend checking out other admin commands systems to see how they’re structured. Some good ones are Adonis, HD Admin, and SimpleAdmin.

test = {
    name = "kill";
    description = "This is a test command";
    arguments = {"Target(s)"};
    run = function(self, speaker, arguments, system)
        for _, target in ipairs(system.getTargets(self, speaker, arguments[1])) do
            local character = target.Character
            if character then
                character:BreakJoints()
            end
        end
   end
}

Thank you for your feedback, I am not so good at modules, sorry and can you basically explain a command and how i would run it? (code wise)

Ok. So basically, there will be a commands module with a command being a table.

local system = {}
system.commands = require(script.Commands)
system.ranks = {}
system.settings = {} -- we will fix this later

We need to have a function to find a command from it’s call, which is below. It will scan through the command to look for a match.

function system.findCommand(call)
    local function validate(commandCall)
        return string.lower(call) == string.lower(commandCall)
    end

    for _, command in ipairs(system.commands) do
        if validate(command.name) then
            return command
        else
            for _, aliase in ipairs(command.aliases or {}) do
                if validate(aliase) then
                    return command
                end
            end
        end
    end
end

We’ll also need functions to manage the ranks. These will simply read and write to the ranks dictionary.

function system.setRank(speaker, rank)
    system.ranks[tostring(speaker.UserId)] = rank
end

funciton system.getRank(speaker)
    return system.ranks[tostring(speaker.UserId)] or 0
end

Once we have the command, we’ll need to have an permissions checker function, and the actual executor function

function system.checkExecutionPermissions(player, command)
    return system.getRank(speaker) >= command.rank
end
function system.executeCommand(player, command, arguments)
    if system.checkExecutionPermissions(player, command) then
        local success, result = pcall(command.run, command, player, arguments)
        if not success then
            warn("Unable to run "..command.name.." command - "..result)
        end
    end
end

We have setup the ranks, and execution. Now all that’s left is the parser and setup.

You could have a complex parser that handles batches and conditions and formats it into a parse tree, but we’re keeping things simple here.

function system.parseMessage(message)
    if not string.sub(message, 1, #system.settings.prefix) == system.settings.prefix then
        return
    end
    local arguments = string.split(message, " ")
    local command = commandData[1]
    arguments = select(2, unpack(arguments))
    return command, arguments
end

function system.onMessage(speaker, message)
    local commandName, arguments = system.parseMessage(message)
    if commandName and arguments then
        local command = system.findCommand(command)
        if command then
            system.executeCommand(command, speaker, arguments)
        end
    end
end

Now we have our setup functions, these will mostly handle signals such as PlayerAdded, and Chatted.

local players = game:GetService("Players")

function system.setupPlayer(player)
    player.Chatted:Connect(function(message)
        system.onMessage(player, message)
    end)
end

function system.setup(settings)
    system.settings = settings
    player.PlayerAdded:Connect(system.setupPlayer)
end

Why would I use this way? Would it be easier to navigate? Easier to add commands? What would make this easier than my way?? Just asking, what makes it easier?

Modular tend to be much easier to install/remove/modify commands, and using a table instead of function for the command may make users easier to modify the command.