Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I make an admin loader?

I am trying to make admin commands with a loader

for ex:

In the loader I have

Owners = {} Admins = {} TempAdmins = {} Banned = {}

Bet = {}

require(AdminCommandsModuleId)

**How would I make this work??

I wan't to make a loader so people don't see the source..**

3 comments

1

Don't bother. Determined people will get the source no matter what.

0

It will still be cool to use, it will also be more organized.. I can also learn new things :D

0

They can't get it if it's not free, though. Unless, of course, ROBLOX is less secure than I thought..

1 answer

Loaders are made using ModuleScripts, and they are generally more secure than having a script in-game.


Here's how to make one:

Create your ModuleScript (name it "MainModule", I also recommend you parent it to ServerStorage, as I have encountered some errors when it wasn't). It can also have children inside it, they get saved with the model.

Test your ModuleScript. If it works, upload it to ROBLOX (don't worry, it can be updated if you make some errors in your code).

Then, require it using it's ID. It will error if you do not own it and if it isn't free.


Example: (Edited)

MainModule (AssetId = 12345678)

local module = {}
local args
local admins

game.Players.PlayerAdded:connect(function(p)
	repeat wait() until args  and admins
	if admins[p.Name] or admins[p.UserId] then
		p.Chatted:connect(function(msg,rec)
			-- player stuff here
		end)
	end
end)

function module:setup(arguments)
	args = arguments
	admins = args.admins
	print("Fun commands " ..("enabled" and args.funCommands == true) or ("disabled" and args.funCommands == false).."!")
end

return module

Script

local args = {}
----------------

args.admins = {}
args.funCommands = true
-- etc.

----------------

local module = require(12345678)
module:setup(args)

There you go, your loader is done. Note that requiring using an ID doesn't work in LocalScripts.


Hope I helped!

~TDP

8 comments

0

How would I make it so it loads the admins in the module so I can do Admins.Chatted? I am trying to make 2 things here. One module, which has the settings and the other one, which is going to be off sale and the one off sale is the ones with the commands and all of the scripts..?

0

Editing.

0

Here is an example for you..

0

local Settings = { Owners = {"",""}, Admins = {"",""}, TempAdmins = {""}, Banned = {} } require(12345678) --[[ IN THE LOADER ]] --------------------------------------- --[[ IN THE ADMIN SCRIPT ]] function onChat(Player,Message) for i,Owner in pairs(Settings.Owners) do if Player.Name == Owner then if Message:lower() == '!hi' then print('Hi!') end end end end for i,

0

I already know, and I have finished editing :P

0

I get module experienced an error while loading?

0

What is the error?

0

There is no error, I just get that.. Thats all.. ;(

This discussion is preserved as it was. New answers, comments, and votes are closed.