What are you attempting to achieve? (Keep it simple and clear)
I am playing around with Private Modules (publishing ModuleScripts to the site and requiring their id) and found an inconsistency that’s either a mistake in the functionality or wrong documentation.
What is the issue? (Keep it simple and clear - Include screenshots/videos/GIFs if possible)
The wiki says that requiring a ModuleScript should only work if its name is “MainModule” OR the user requiring it is the Module’s owner:
So I tested it by publishing a ModuleScript to the site without calling it “MainModule” (because I don’t want others to be able to require it), then required it in my script and tested it in a server:
After seeing that bug I changed it to “MainModule”, which of course worked.
What solutions have you tried so far? (Have you searched for solutions through the Roblox Wiki yet?)
Apart from what I covered in “What is the issue?” I don’t really think there’s an obvious solution here.
Is there something I’m missing or is it a documentation mistake?
ModuleScripts named “MainModule” can be required by their asset ID.
Vice versa, modules uploaded as free models, which aren’t named MainModule cannot be required by their asset ID.
If the model is either publicly available or you own it (and named MainModule in both cases), you can also require it from within Roblox Studio.
That’s what I thought, but according to the wiki documentation a ModuleScript
“can only be required by the user who uploaded it, but if the ModuleScript is named “MainModule”, then any game can require it.”
That makes it look like you can require it as the asset’s owner without having to publish it named “MainModule”.
In your case however, desired functionality can be achieved via InsertService as only you can insert your own modules from where you can proceed to require them.
The issue here from what I see is that either the wiki has a typo, or it’s a bug.
The wiki states that if the module is not named “MainModule,” then only the owner of the module can require it by it’s assetid in their own games. However, if it is named “MainModule,” then anyone is able to require it by the assetid. What OP is trying to get out (I believe) is that he published a module that isn’t named “MainModule” and is unable to require it by it’s assetid in his game, as mentioned in the wiki.
InsertService is more for inserting models on the game owner’s profile.
@OP, for now you can use InsertService until I get a clearup whether it’s a bug, or the wiki is outdated.
The wiki says it ambiguously, but this may have been a new change to the page as I don’t remember having issues understanding when I first found it a while ago.
Not sure but can agree it doesn’t exactly say on the page whether the functionality is intended or not.
Just worded wrongly. Everyone can require a MainModule in an online server. The owner (or people that have access to the model, just like any other model) can also require it in studio. (Short: if you can insert it in studio, you can require it)
You can’t require something that isn’t called “MainModule”