How do use requires to open an GUI

:

  1. What do you want to achieve? Keep it simple and clear!
    How do I use requires to open a GUI?

  2. What is the issue? Include screenshots / videos if possible!
    I can’t use requires to open an GUI.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked all over YouTube but can’t find any solution

require is a function used for requiring module scripts? What is your use case for wanting to use the require specifically?

I’m using requires to open an gui which im planning to sell

But why require? You did not answer that question yet. Why not just set the visibility of the gui?

I don’t want want my client’s to leak and I need to update it

Using a module script or require alone, whatever you’re trying to do, won’t prevent leaking. Your client is buying your product. They need to be trusted. And what are the chances this will even happen in the first place? What you don’t know won’t hurt you if it does happen.

Keep in mind that unless you obfuscate your the code within your MainModule, the client will still be able to easily read it as the MainModule must remain public.

However, if you wish to use modules to make an easily updated GUI, what you would have to do is upload your MainModule script to roblox, then require the asset’s id (can be found in the url).

`local module = {}

function module.load(target)
_G.target = target
local target = game.Players:WaitForChild(_G.target)
script.guinamehere:Clone().Parent = target.PlayerGui
end
return module`