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

How would you require a module script and place it somewhere?

Asked by 8 years ago

I know this can be done because I have seen it done in Epix Incorporated Server Suite, where it requires the main module and sets its parent to one of the folders, I looked at the script and was confused as to how this could be done. Here is what I have so far:

local worked,why=ypcall(function() require(461660539)(script) end)
        if not worked then 
            warn("There was an error when requiring the admin module.")
            warn("Error: "..why)
        end

But that only requires it, I am wondering how to place it to a location in the game?

1 answer

Log in to vote
1
Answered by 8 years ago

The Module you are using returns function, being that why the parametters are script. To place it in a location on your game you must make the ModuleScript clone/parent itself somewhere else on your game.

To do this, you could instead insert the ModuleScript with InsertService into your game, parent it and require it, or, on your function you could make it clone itself and parent.

0
How would I do that? Also what is the (script) after the require, I can't find any explanation for that. UltChowsk 85 — 8y
0
And, how would I require a specific function? would I use require(461660539:function) ? UltChowsk 85 — 8y
0
You could do local m=script:Clone() m.Parent=workspace | Plus to use a specific function just do tableName = {} tableName.function = function() end return tableName marcoantoniosantos3 200 — 8y
Ad

Answer this question