Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Does '_G' work between two local scripts?

Asked by 10 years ago

I have two local scripts and I want them to share a variable, and the first way that I tried crashes studio so this may be my only other option. Is it possible?

1 answer

Log in to vote
1
Answered by
wrenzh 65
10 years ago

Yes, but you cannot use anything added to the global table in a LocalScript from a Script.

Items added from a Script can be accessed in a LocalScript, but not vice versa.

0
Also, if you add something in a local script, it's only in the _G table for that client. So, _G.number could have different values for different players, or not exist at all for one player ipiano 120 — 10y
0
Yes, I should've added that. wrenzh 65 — 10y
Ad

Answer this question