So, I want to hide the code for one of my scripts by requiring a module by ID, how can I make it require a different one each time? The reason I want to do this is because if it requires the same module then each player's variables get redefined (this is for a leaderboard) causing the player that last joined to get their deaths changed each time someone dies! This is really annoying and since ROBLOX have made this change I haven't found a way around this. If this is impossible I guess I'm just going to have to keep the source code in the actual script. I just hope there's a way...
✓ ANSWER ACCEPTED
[SOLVED] Any way to require a different module each time?
2 answers
✓ Accepted answer
An important feature of modules is that if you require the same module, you get the same object returned.
The act of requiring a module shouldn't do much -- if it does, and that's a problem, then you haven't designed your module looking towards the future.
If there's any reason you need to use a "separate" copy of a module multiple times, it should be returning a function which does that setup, instead of that setup just being done in the body of the module.
What the guy that answered said!
This discussion is preserved as it was. New answers, comments, and votes are closed.
