How to access variables in another script? Example:
Script 1: local x = 1
Script 2: print(x)
How? It should be THE EASIEST WAY POSSIBLE! I don't need any complicated values to be transfered, only simplest integers!
Lol
Script 1 : _G.x = 1
Script 2: print(_G.x)
Ok so the _G. Thing before any variable basically access the global namespace table and stores your variable in there which is why you can use it outside of your script :)
Modules are good but they're not as quick to implement as what I said but if you don't mind learning what they are and do then here it is:
You basically make a table and put all your stuff in it your variables and functions etc. Then use require keyword to get your module table and boom you have your own namespace this is quicker to access because the global namespace has a lot more things than just your variable and continuous use without attention to garbage collection can get it cluttered. There you go.