So, in most scripts, people use Global variables no matter what. However, Roblox suggests that I should change a global to local ,why so?
local a = true
b = false
whats the catch?
So, in most scripts, people use Global variables no matter what. However, Roblox suggests that I should change a global to local ,why so?
local a = true
b = false
whats the catch?
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Usage of global variables is bad practice, they make your codebase a mess. Additionally, they pollute the global namespace and increase the risk for a name collision. Although negligible, local variables are only ever so slightly faster for each access than global variables.
And for those people who use global variables, their code isn't very great. It is recommended that you always use local variables.
Please use the site search https://scriptinghelpers.org/search?search=local+variables&what=questions
This is a very common question. Also most people do not use global variables. Often people see youtube videos and just copy badly made tutoirals without any research