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)
05 | game.Players.PlayerAdded:connect( function (p) |
06 | repeat wait() until args and admins |
07 | if admins [ p.Name ] or admins [ p.UserId ] then |
08 | p.Chatted:connect( function (msg,rec) |
14 | function module:setup(arguments) |
17 | print ( "Fun commands " ..( "enabled" and args.funCommands = = true ) or ( "disabled" and args.funCommands = = false ).. "!" ) |
Script
05 | args.funCommands = true |
10 | local module = require( 12345678 ) |
There you go, your loader is done. Note that requiring using an ID doesn't work in LocalScripts
.
Hope I helped!
~TDP