Hello,
What I'm trying to do is, using a LocalScript, access a module through invoking a RemoteFunction which will return the contents of a ModuleScript in ServerStorage. To do this, here's what I setup...
Server (Script) [ServerScriptService]
local getClasses = Instance.new("RemoteFunction", game:GetService("ReplicatedStorage")
getClasses.Name = "getClasses"
getClasses.OnServerInvoke = function(p)
local module = require(game.ReplicatedStorage:WaitForChild("Classes"))
print(module) -- debugging
return module
end
Classes (ModuleScript) [ServerStorage]
local test = {
["Hello"] = function()
print("hello world")
end
}
return test
LocalScript [StarterPlayer > StarterPlayerScripts]
local rf = game.ReplicatedStorage:WaitForChild("getClasses")
local class1 = rf:InvokeServer()
print(class1, class1.Hello)
When you run the game using these, it will output table: 0x55bf868d9edefc4b nil , while the expected output for me would be something like table: 0x00 function: 0x00.
However, I don't understand why. I'm guessing it's something to do with networking.
The reason for me doing this is to have hidden pieces of code I want to hide from possible exploiters who constantly work towards leaking proprietary content. And since ROBLOX has disabled the feature to use the require() on a off-sale model, I sincerely don't know what to do.
If anyone knows a fix for this, or possibly a better method, please let me know.
Thanks,
- R455

3 comments
There is no point in trying to hide your code from exploiters - they can still see all your client code.
Not necessarily, if I worked the code around module scripts hidden in ServerStorage, exploiters wouldn't be able to see that
@rodrigo455 What you should do is split what you need to be seen by the client and server into different modules. Exploiters can abuse your Remote Functions to get contents of the module script you returned. They are also able to read your local scripts so it doesn't matter if you destroy the RemoteFunctions because they can just create one.