#calling values in another script
1 messages · Page 1 of 1 (latest)
** You are now Level 8! **
you could send the table trough a bindable event
module scripts
or bindable events
do your own research on them
u have to call them in a modeule script?
no
if you have something that needs to be used in more than 1 script, it's general practice to put that into a module script
in this case, you'd move the function into a module script and then you can require that module script in the scripts you want to use the function in
YouTube can do that better than me
this guy is pretty good at explaining stuff in my opinion
📜Join my Discord Community if you want scripting help, give feedback, or just hang out:
https://discord.gg/WC6kPu5W5P
🔴Watch My Full Roblox ADVANCED Scripting Tutorial Series:
https://www.youtube.com/playlist?list=PLQ1Qd31Hmi3WKkVHnadvhOOjz04AuMYAf
🎨Watch My Full Roblox GUI Tutorial Series:
https://www.youtube.com/playlist?list=PLQ1Qd...
This is almost universally discouraged, but another quick way to share values across scripts is to use the _G global table to store them, for example:
Script A
_G.Key = "SDF09SDF"
Script B
print(_G.Key)
Just note the order in which you initialise and then read matters - if the line in script B runs before script A, it'll print nil. Also, it can quickly get polluted. So just be really careful. I'd recommend module scripts but I wanted to let you know about _G as well, though maybe I am a bad person for doing so...
weren't modules created to replace _G ?
** You are now Level 10! **
yeah, he literally said that its very discouraged
to use _G