Admin Commands for Dummies (Part 1)
Difficulty Level: 3/5 Stars

I've finally decided to make more tutorials. This one is on admin commands, hence the title. This is decently difficult and mainly requires lua knowledge. I plan on splitting this into 2 - 3 parts because of the complexity. Anyways, let's get started.

What do admin commands do?
Admin commands simplify the lives of staff members of certain games. There are levels of power which each offer certain commands. For example:
(Format: [Admin Level] - [Commands])
Player Level - cmds, reset
Moderator Level - cmds, reset, kill, forcefield
Administrator Level - cmds, reset, kill, forcefield, shutdown, kick
Owner Level - cmds, reset, kill, forcefield, shutdown, kick, ban, btools

Creating Your Settings Script
All admin commands have a source. You'll usually just see a loader with some code such as:

require(8374905);
-- or
require(8374905)();
-- or
require(8374905).run();
-- etc.

Point being that that isn't all the code that admin commands has. I suggest you read up on my tutorial for module scripts that can be found here. Our admin commands will be using something similar to the second example to load it. We'll talk more about this later though. For now we'll work on our settings script.

First off, our settings script will be a module script. Here's how it should look:
(Also, there might be some confusion with my username. My roblox username is AstrealDev, my discord username is Mayo, and my SH Forums username is mccrafter1212):

return {
    ["Admins"] = {
        ["AstrealDev"] = "Admin";
        ["Player1"] = "Owner";
    };
    ["Other"] = {
        ["LightingFix"] = true; -- Not actually scripting this. Just showing as an example that you can use other settings.
    };
};

Ok, our settings script is done. Now when ever we require() that script we'll get a table containing our administrators. Although, this isn't exactly efficient. Checking for a string isn't the best thing even though we can use if statements to decide if it's a valid string. We'll be parsing the strings into numbers which will represent rankings. If you don't understand this don't worry for now.

Creating Your Main Script
This script will be a server-side script. We'll be assuming that the settings script is put into the ReplicatedStorage. Although, you can create a search script which will search the whole game for the script. Here's our main script:

local admins, commands, settings = {}, {}, nil;

-- Extremely basic isAdmin function - If you don't understand you shouldn't be here
local function isAdmin(playerName, rankRequired) do
    if (admins[playerName] ~= nil) then
        if (admins[playerName] == rankRequired) then return true; end
    end
    return false;
end

local function locateSettings(path)
    if (path:FindFirstChild("Settings") ~= nil) then
        if (path:FindFirstChild("Settings"):IsA("ModuleScript") then
            settings = require(path:FindFirstChild("Settings"));
        end
    end
end

This was all pretty basic scripting. Part 2 will include more code and we'll get into making a command and a command with more arguments.

Thanks for reading :)