Module Script Question

So, Recently I Made a ModuleScript. I Saw people Using a Weird way to Use require().
What I want, Is Making that to Connects with Other games Without needing it on Game.
For that, Some People Use the Module’s ID On Library and Putting it On require().

Code Example:

local module = require(123456789) --Random Number Here (This Is what Im Talking About.)

module:MakeStuff("string", 123) --The Function.

My Problem, Is that Im Trying to Insert it On Game, But it Gives me an Error on Output Even If is Already Published and Allowed a Copy.

Here Is Output:

Unable to find module for asset id 6995411300. Does the asset have a ModuleScript named “MainModule”?

My ModuleScript Isn’t Named MainModule.
It Would be Really Nice to give me an Answer, Thanks.

usually when you see a require followed by an id, its a virus/backdoor that breaks your game. But if you want to do it, upload the modulescript as a model and require the id

1 Like

That’s The Problem, Is Already Uploaded and Even with That, Still Don’t Works.

The module script needs to be named “MainModule” → Right click and save it to roblox as a model → copy the models id and use it as the require id.

The random number is the assetID of the module you saved to roblox.

I’ll Try That. So Much Thanks.

Thanks It Worked. It Will Help me a Lot. :slight_smile:

No problem! Glad I was able to help. Goodluck with your project!