Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make an admin loader?

Asked by 8 years ago

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..**

1
Don't bother. Determined people will get the source no matter what. User#6546 35 — 8y
0
It will still be cool to use, it will also be more organized.. I can also learn new things :D BadLuke1 2 — 8y
0
They can't get it if it's not free, though. Unless, of course, ROBLOX is less secure than I thought.. TheDeadlyPanther 2460 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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

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..? BadLuke1 2 — 8y
0
Editing. TheDeadlyPanther 2460 — 8y
0
Here is an example for you.. BadLuke1 2 — 8y
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, BadLuke1 2 — 8y
View all comments (4 more)
0
I already know, and I have finished editing :P TheDeadlyPanther 2460 — 8y
0
I get module experienced an error while loading? BadLuke1 2 — 8y
0
What is the error? TheDeadlyPanther 2460 — 8y
0
There is no error, I just get that.. Thats all.. ;( BadLuke1 2 — 8y
Ad

Answer this question