Recently, I found out that using Module scripts allows me to protect my work from clients till the script is complete. One problem occurred when trying to require a MainModule script from the client because it won't allow you to use the 'require()' on the client. After fiddling with RemoteEvents, I've finally ended up with a method to require a module from the client.
After solving that problem, I figured out that it will not work when running it in-game.
-- ServerScript 'A' (located in game.ServerScriptService)
local events = game.ReplicatedStorage:FindFirstChild("Events")
events.Animations.OnServerInvoke = function(player)
local module = require(980963185)
return module
end
-- ModuleScript 'B' (located in game.ReplicatedStorage)
local module = game.ReplicatedStorage.Events.Animations:InvokeServer()
return module
-- LocalScript 'C' (located in game.StarterPack)
local ninmodule = require(game.ReplicatedStorage.ModuleScript)
ninmodule.Animations()
The result from running the script is as follows:
-- Players.Player1.Backpack.[S] Animations:4: attempt to call field 'Animations' (a nil value)
-- Stack Begin
-- Script 'Players.Player1.Backpack.[S] Animations', Line 4
-- Stack End
Is there any solution on how to call the module function from the client with Filtering-Enabled on?

1 comment
Heads up: You can't pass functions from the server to the client (and vice-versa) through Remotes. Arrays, Dictionaries, and Instances are OK, however.