An admin system / template you can build off of!

Today I have taken the time to revisit the idea of admin commands. Since I will be needing a system of my own at some point, I whipped together a small module script based admin commands template. It definitely is more organized and easier to edit than the end result you get from the tutorial I wrote long ago.

Features:

  • A command template to view and experiment with. It allows for easy creation of new commands!
  • A walkspeed command to give an example of a functioning, complete command.
  • Supports abbreviations like “all”, “others”, “me” etc
  • Allows for adding admins manually and changing the prefix.
  • Supports commands having multiple usages. EX: “/Teleport”, “/Tp”

Players are returned through a table, not as Instances.

The code is somewhat messy due to it being originally written for just me, but hopefully somebody can learn a thing or two from it!

Here is the download link:
AdminTemplate.rbxm (3.2 KB)

Here is the entire hierarchy of the system:
image

Take care everyone!

Update 1: Patched a bug where normal messages will cause an error.

6 Likes

Could you provide more sceenshots or a github link?

1 Like

Screenshots of what? It behaves just like a normal admin system. I included a screenshot of the hierarchy. I’ll provide how commands are executed and the template command:

return {
	Usages = {"Test", "AnotherUsage"},
	
	Callback = function(sender, player1Name, player2Name)
		local Core = require(script.Parent.Parent.Core)

		if player1Name and player2Name then
			local p1Table, p2Table = Core.FindPlayer(player1Name, sender), Core.FindPlayer(player2Name, sender)

			if p1Table and p2Table then
				print(p1Table, p2Table)
			end

		end
	end
}

You would execute this command like so:
“/test playerA playerB” or “/test me all” etc

The commands get executed in my module like so:

module.ExecuteCommand = function(cmdModule, sender, args)
	require(cmdModule).Callback(sender, unpack(args))
end

As for github, I’ve never used it so I am not sure how I could put stuff on there.

There seems to be an issue when you type a normal message!


You could fix this by replacing the “FetchCommand” code with:

module.FetchCommand = function(cmdName)
	return cmdName and script.Parent.Commands:FindFirstChild(cmdName)
end
1 Like

Thanks for catching this! I will add a check to make sure that it doesn’t try to find something that is nil.
Going to update the download link once I fix it!

EDIT: It is fixed.