I can't find any source to this question, I really need to know the uses of global variables and what they are..
"Unlike global variables, local variables have their scope limited to the block where they are declared. A block is the body of a control structure, the body of a function, or a chunk (the file or string with the code where the variable is declared)." Source
Essentially, if you declare a local variable in a function, if statement, or loop, you can't use that variable anywhere else. If you declare it out of the function, it can be used anywhere in that script. Global variables can be used anywhere, whether they are declared within a function or not.
To declare a local variable:
local variableName = 12
To declare a global variable:
variableName = 12
Marked as Duplicate by hiimgoodpack and Filipalla
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?