I want to share a variable between two local scripts on the same client without merging the code into one local script. I haven’t found a good way to do this and I would prefer NOT using remote events.
The idea is that one local script monitors inputs using the UserInputService and updates a table so that the other local script can read from it each frame to make decisions based on the input table.
So far I’ve read similar posts stating using _G and module scripts, but it was not explained in detail how that works. I’m familiar with module scripts, but from memory and experimentation, I can’t use a local script to manipulate a variable in a module script and expect a different local script that required it to have the same manipulated variable.
Well, Remote events are usually slow due to the physical space the data must travel and I’m concerned that using them for client-to-same-client communication might require travel outside my client (for reasons unknown) thus slowing down the update.
This variable is a nested table. The top level keys are strings, like a dictionary. The 2nd level is a list of strings.