Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's the difference between local and _G?

What's the difference of using local and _G? I just want to know the difference and when to use them.

2 answers

✓ Accepted answer

_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

This discussion is preserved as it was. New answers, comments, and votes are closed.