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 the same ID more than once?

So I have this require module script,

local Module = 2244764687
require(Module)	

when I require it the first time it works perfectly fine. When I require it a second time(from a different script) it does nothing.

3 comments

0

Can we see the other script

0

And the module script

0

the second one is the same script

1 answer

✓ Accepted answer

A module script only runs once per server, and once per client. If the server requires the same module multiple times, it will just return whatever it returned the first time to the other requests.

In most cases though, you shouldn't actually run anything in a module script. Usually you can use it to return a function that you use inside your script or any other variable.

So if your module is:

randomNum = math.random(1, 10)
print(randomNum)

return randomNum

It will only print once on the server, and every script that requires the module will return the same random number.

Hope this helps! :)

2 comments

0

Well my module is just cloning scripts into a model inserted into the workspace then renaming that model. And from this im seeing it will only let me do that once?

0

Never mind, I found a solution. Thanks for the help.

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