What's the difference of using local
and _G
?
I just want to know the difference and when to use them.
_G
is a table that is shared across every script in a given environment (server separate from client separate from corescripts)
local
is a keyword for defining variables in the local scope so that they cannot be accessed or changed outside of the block they are defined in.
_G --means global, a variable used for all scripts in the server local --means it is a variable only used for one function