Can I exchange values between scripts? I’m curious
Yes, ModuleScripts
are incredibly handy for this. ModuleScripts
typically are tables that are returned to whatever script requires them (in reality, you can make it return whatever you want). Assuming a table is returned, writing to the table replicates to all other scripts requiring that module in the same runtime environment (ex: client, server). Modules can become more complex when you mix in functions that can also return values.
No one’s gonna help you if all they can see from the homepage is question………,.,…,…,:.,
bruhhh dont use such titles lol
You can use:
1: ModuleScripts (best option)
2: BaseValues
3: BindableEvents (worst option)
ModuleScripts are scripts that only run when you call require()
on them in other scripts. The return of this function is what the module returns. A module must return one value that is not nil. This value is cached, so the module is not ran twice!