I’m looking at utilising ModuleScripts to store Data regarding my Starship -
Only issue is - The data is initially set up on the Server and then transferred and stored into a seperate Module for Storage.
local _DATA = {}
Module.EDIT = function(Child, Value)
_DATA[Child] = Value
end
The flight system relies on Client control; Does this mean when I require it again via the Client, the _DATA will reset? And if so, what could I do to change this?
I don’t know if this is what you want to know:
When you edit the variables of a module from the client, they will only change for this one.
When you edit them from the server, it will change for everyone.
However, the Ship will have a Dictionary that stores relevant values etc. But since the _Dictionary is global - It’s reset when called from either Server or Client. I need a way of either not resetting it or retrieving the data.
The server and client each get different instances of a module upon require, they aren’t shared. Whatever the server puts in the _DATA table will not replicate to the client’s instance and vice versa. Consider using ValueObjects or Attributes (when they’re live) as alternatives here if you have simple values that you intend to put in the dictionary (e.g. numbers, strings, so on).
You can send data through a RemoteEvent. There are some caveats (for example, metatables will not be sent). I recommending checking out this dev hub article: