I have an issue with the require module

Hello developers!
I have an issue with trying to require a script using require (ID)
I have made a soft shutdown script that I don’t want the script leaked to anyone as I am making a paid service but trying to write the simple thing Require (ID) doesn’t seem to trigger the script when I press shut down all servers.

  1. What do you want to achieve? I want my server to perform a soft shutdown using a completely different game using require

  2. What is the issue? Include screenshots / videos if possible!
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I did but i couldn’t find any results.

-- require (5503170958)

Does the module script named as MainModule?

Is your module structured something like this?

local module = function()
	print("Hello world!")
end

return module

If so, you can call the module function without needing to set it to a variable by adding () to the end of the require.

require(5503170958)()

If you get that error “Unable to find module for asset id” that mean you should name the module script “MainModule” instead of “ModuleScript”.

1 Like

Hey @MayorGnarwhal the main script does not have that shall I add it to the main script?

Alright I will try that thanks.

@MayorGnarwhal An update i have noticed that the script was not a module script so i replaced that with a module script but the main script no longer working.

The script you’re trying to require needs to be “free”, as in everyone can take it… There’s nothing you can do about it since roblox removed private modules.

What I recommend doing is obfuscating the script you’re trying to require. There are some very good ones out there (like WallySecure)

Hope this helps!