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.
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.
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! :)
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?
Never mind, I found a solution. Thanks for the help.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Can we see the other script
And the module script
the second one is the same script