Alright so I decided I would start helping some of my friends but I don’t want to take the chance of them stealing my stuff and giving them to others.
Is there a way to use the require command for normal scripts and if not, what can I do to in replace of it?
What I am attempting to do is have it where people can’t steal my scripts while still being allowed to use my scripts. A good example, a lighting script I have… I want to let my other friends use it but I don’t want them to steal it or edit it. What are my options?
I have viewed the Developer site and Q & A sites and I haven’t really found much on it.
When, you require you are essentially grabbing or fetching a module scripts(they are very handy (: )
This issue here is that, Allowing someone to use your code, but not allowing them from stealing is pretty hard(to my knowledge) using roblox, along with this, I believe there is no clear cut way of checking if a player has edited your code either.
This is a resource that might give you some more insight:
Hide it in a bunch of empty models, folders, and other stuff and hope they won’t find it?
Do plant in decoys too to confuse them
Many malicious scripts work that way, so it makes it hard to find. You wont have to use require at all. Just write your code from the scope of the hidden script.
Inside of StarterPlayerScripts, insert a localscript that makes the modulescript a global variable, then rename and destroy the ModuleScript AND call script:Destroy() so it’s harder to trace back to the ModuleScript.
Then, in every script that uses the ModuleScript to function (besides the server), use require(_G.modulescriptvariable). Below is an example on how I secure my ClientModule.
wait()
if not _G.soup then
_G.soup = game:GetService("ReplicatedStorage"):FindFirstChild("ClientFramework")
end
if _G.soup then
local ooga = game:GetService("ReplicatedStorage"):FindFirstChild("ClientFramework")
ooga.Name = "salads"
ooga:Destroy()
script:Destroy()
end
script:Destroy()
Hope this helped. It makes the ClientModule accessible without having the risk of it being stolen. I know that there are better methods out there, but this is the one that I personally use.
I believe they were looking for ModuleScripts that would not allow other developers to see its source as compared to players not being able to see the source.
To answer the OP:
With the current powers that Roblox has given us right now, it is not directly possible to create closed-sourced modules in Studio. This feature was removed after a series of malicious scripts were found on the website. However, there are third-party resources available to you (some linked by a previous poster).
Please note, however, that if you use a third-party closed module system, the host (reator of the third party service) holds all rights to the scripts that you store on their systems and are able to release it at any given point regardless of your permission. That means that while it is closed to the rest of your players and developers, the creator of the third-party service will always be able to access your scripts and Roblox will have no power in aiding you if your scripts are leaked.
require() is only used for ModuleScripts, meaning you should publish a Module (if you know how to use them) to the ROBLOX website, then get the ID of it. After you do that, you can send this code to a friend: require(1234567890)
It should be very simple.
TLDR; Roblox’s built-in module system does not allow to make it closed-source anymore. That means, even if you ask your friend to use require, they will still be able to see your module script and what’s inside.
So what happens if you’re making the module script that you uploaded become private? The script simply won’t work, the require becomes useless.
This should be very helpful, helped me learn modules too.
well , not going in much complexity you can use modules to share functions like for example, create a module called functions, keep it in ServerScriptService .Next create a regular serverscript parented to it, (for demonstration)
like this
then in the module do something like :
local functions = {}
--function storage, convenient
function functions.prints()
print("1 worked")
end
function functions.go()
print("2 works too")
end
return functions --exactly one value is returned as you can see
in the script :
local functions = require(script.Parent)--requiring the module, receiving the values i.e functions
functions.prints()
functions.go()
just for people new to module scripts, but in your case, your module can only be required from you asset id if you’ve published it , make it private, that’ll prevent others from requiring it in their scripts