Is the best (or only) option we can use to run a Module on the Client, when you need to require the module both on the Server and Client, and it is in ServerScriptService, only to clone the module and parent it to the Player and require it from there on the Client?
Basically , It is located in ServerScriptService as I need to require it on the Server, but since the Client can’t access that should I keep 2 of the same module, one on the Server and one on the Client?
If I were to do this for several modules would there be a better method?
Note that these modules concern DataStores and contain code to write to and edit it
There is no way a client can access serverscriptservice due to filtering enabled. The only way a client and module can read from it is for it to be in a place a client script can read it from. Else i would just suggest throwing your DataStore into a script.
Perhaps think about using RemoteFunctions and RemoteEvents to get the communication going and making sure the server has optimal control. Writing a module script for Data Store using the OOP technique of encapsulation is a good idea, where you can connect the set and get functions to RemoteFunctions. It might be worth adding in a server script as well which listens for the connection so it can run various sanity checks, then call upon a function from the Module once it’s verified that the Data Store transaction is legit.
As exploiters can edit code inside client-side scripts modules are the most targeted by that. So no. You shouldn’t. I would recommend doing a normal script for your datastore
Im not sure what he is talking about. I have seen datastores set up in modules before and they worked but i havent personally tried it. And require asset id may work. I have never personally used it before.
instead of merging all modular code into one script, is it better to simply use Remotes to get certain information from the DataStore and on the Client, using the Value received. But I would have to fire those events for every type of data, each time it changes.
I would just keep it on a server script. And im not sure what type of data your having to send over. If you set it up with all the value data inside the player. Then save data on leaving you should be fine. As long as your adjusting the data (ect. Money, XP) server side its non exploitable and works well.
If you do use RemoteFunctions a Exploiter can just spam fire the Remote to throttle your DataStore (Unless you put cooldowns in them). But why do you need to access data on the Client anyway?
So like money? if so still. Your client side can access those values just the same. The only sending over you need to do ever is client to server. Client values arnt replicated on server side due to filtering enabled to stop exploiting. But when the server value is updated its replicated across client side
So use a .Changed event for those values, to detect when they are changed and then get the latest values (all stats, i.e “Coins”, for example, “OpenedCrate”, etc.)
and use those to update the Gui?
Is this a good idea for values that will constantly change , a lot of them?