How to require a module without making it public

I have been trying to require the following module that I own and am getting the following error in studio and in game.
image

The code I use to require it:

require(2788185776).load("ah");

The code in the module script:

local module = {}

module.load = function()
	print("Loaded successfully")
end

return module

The module: https://www.roblox.com/library/2788185776

I have tried making a new module, and yet it still does not work. It does work if I make the module free, but I don’t want it to be grabbed by everyone. I own the module, yet I cannot require it.

Thanks,
-REALTimothy0812

1 Like

Why don’t you just copy the code of the Module and paste it into a moduleScript instance in the game? Then you require that instance. Modules don’t have to be on the website.

This seems like a bug? Is the module named MainModule?

Have you named the module “MainModule”?

Also, if it is named MainModule, make sure it isn’t a child of anything such as a folder or another module.

It is. Whether modules are public or not, they have to be named MainModule to be able to be required with their assetId from the website. Why it’s not requiring is beyond me. I would say something like “requiring assetIds doesn’t work from Roblox Studio” but I haven’t tested to confirm this and OP owns the module.

2 Likes

It must be a problem with your module. When I tried to require it in my two games using the asset id from your code, it gave me the same error as yours each time.

Make sure the module is named MainModule and that it’s indeed a ModuleScript.

1 Like

From the looks of this:

It is a ModuleScript called MainModule.

1 Like

Save it as a LinkedSource in a game or use it in the actual place. Main site private modules were turned off for security reasons

1 Like

I wanted to load the module from multiple games without having to change it every time. For others interested, you can require it by doing the following:

require(game:GetService("InsertService"):LoadAsset(<Asset Id>):GetChildren()[1])

Thanks to those who helped,
-REALTimothy0812

11 Likes