Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

3 comments

0

How would I do that? Also what is the (script) after the require, I can't find any explanation for that.

0

And, how would I require a specific function? would I use require(461660539:function) ?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.