Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

MainModule and PrivateModule, how to use them?

Hi guys!

So I recently got into this ModuleScript business and I'm quite interested..

Let's say I'm working for this kid who pays me on a monthly basis in return for usage of my scripts, and he ends up not paying me after 3 months. I would be able to completely disable my scripts if I were to link all my scripts to my PrivateModule.

Now my question is; How the hell do I link them?

I've created a simple MainModule script with the following code:

local module = {}

	function module.test()
			print("Working Module!")
	end
	
return module

This ModuleScript was named "MainModule" and uploaded as a Model to ROBLOX. I copied the ID and pasted the following code into my NORMAL script:

module = require(ID_HERE)
module.test()

I published my game, but whenever I try to test the scripts in studio I get the error "Unable to find module for asset id" in my output, and I see no print from the ModuleScript.

Is there any way for me to fix this issue? I would honestly love to use this type of script, but for some reason I just cannot manage to get it to work..

Another question about these scripts is; How do I make sure only I can access this ModuleScript (Refering to the kid who didn't pay up)? I want to save my MainModule as a ROBLOX Module, be able to update it in my own games, and then have it update on other games where it's linked aswell via the require code.

Thanks!

1 answer

✓ Accepted answer

Basically, if somebody else tries to require it; you can just blacklist their place id; or creatorid. If you check the "game" object, it will show you the place id; aswell as the userId of the player who created it. You could also check for a gamepass etc. Monthly renewals would need to be manually done, unless you had an external service that handled it, with the module script checking an endpoint api to see if that user has payed their fees etc.

3 comments

0

Note: I once tried this kinda stuff. Turns out, people aren't always offering to pay for stuff like this. You would need your scripts to be extremely complex and useful for anyone to want to buy it.

0

No no, you're getting me wrong. I ment it as a way where all my created scripts are linked to a private modulescript, so if they end up scamming me or not paying me at the end of the month, I would just update the script to disable all of my other scripts in their game.

0

The module scripts could require another module script; which just represents a value like names or something of blacklisted players, or even just a true/false value.

This discussion is preserved as it was. New answers, comments, and votes are closed.