I understand how to use PrivateModules well enough. I've read the Wiki article on them and it always made me a bit uneasy.

There are two bits that it mentions under the security section, those bits being:

The most effective way to prevent this type of exploit is to place this line of code at the beginning of your ModuleScript:

script = nil

This will erase all references to the ModuleScript, preventing the exploiter from obtaining a reference to the ModuleScript. If your ModuleScript has children, you can do this:

local children = script:GetChildren()
script = Instance.new("ModuleScript")
for _, child in pairs(children) do
  child.Parent = script
end

I get what they're meant to do, but I still feel like it's too hard to trust them. I have no way of testing these methods and I worry about my work being stolen. Do I just add the second one to the module as well? Does the first one go into the module and the other the requiring script? I mean, it seems like only one of them can work at a time since both of them change what the variable "script" is. I'm very confused.

Any tips or words of advice?

3 comments

0

script:Destroy() is usefull before returning a value

0

Can't you just throw the module inside of the serverscriptservice

0

I don't believe that works if I need the scripts to run from the client.