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

How can I use require() to load in my model?

Asked by 7 years ago

Hello. I have an anti-exploit server protection gui (This is not a single script! It consists of GUIs AND scripts!)

I was wondering how I could make it into a 'loader':

-- Here you would add some instructions, for example turn HttpEnabled on...
-- Then it would say this:
require(AssetId)
-- And then maybe something else to do with the MainModule.

I am aware of the MainModule, but how do I use it? Thanks for your help.

1 answer

Log in to vote
0
Answered by 7 years ago

To answer your question you would first have to create a module then place your items such as guis inside it in folders (not required but is neater) then name the module MainModule so you can require it your module will look like this.

local module = {}
-- You will place your code between these such as

gui = script.Guis.YourGui:Clone()
gui.Parent = game.Players.Player1

-- as u can see you would need a folder called Guis then the gui named YourGui inside the module
return module

as to require it all you have to do is require the asset id and your done

0
Thank you for your answer. Wilbob30 69 — 7y
Ad

Answer this question