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?

4 comments

1

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.

0

And for those people who use global variables, their code isn't very great. It is recommended that you always use local variables.

0

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