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