So someone helped me out when to use module scripts but I was wondering how module scripts could work with a local script. First, how would I pass the player to the module scripts if I was just requiring them and even if I was using functions in the module script to which I could pass the LocalPlayer, wouldn't that be exploitable? Also someone mentioned that I should use remote events/functions for client and server communication but how would I be able to use those in a single-script architecture with module scripts? Hope you guys can help. Thanks!
links to where people said what I mention in the question:
You don't need to pass the player at all, ModuleScript
s get executed by the script they are required by, so if required by a LocalScript
or, recursively, by a ModuleScript
required by a LocalScript
, they can do anything the client would normally do.
There is no difference in the level of security between using modules and not using them.
Remotes would be used just like normal in modules that it'd make sense to respond to them from.