https://www.youtube.com/watch?v=UVLXjwqOQKI (Link)
On the link youtuber just makes variable without using local.
Script
Particles = script.Parent.Parent.ParticlesPart.ParticlesEmitter
script.Parent.Touched:connect(function(Part)
local IsPar = Part.Parent.UpperTorso:FindFirstChild("ParticleEmitter")
if not IsPar then
local particles = Particles:Clone()
particles.parent = Part.Parent.UpperTorso
else
Part.Parent.UpperTorso.ParticlesEmitter:Destroy()
local particles = Particles:Clone()
particles.Parent = Part.Parent.UpperTorso
end
end)?
as you see on
Particles = script.Parent.Parent.ParticlesPart.ParticlesEmitter
Why does he not use local for making variables? And why do we have local if we can just create variables without local? Please answer.

5 comments
Because it's bad practice. A variable that is not local is by default a global variable. Global variables make your codebase a mess. There's also that negligible speed difference. Local variables are only slightly faster to access than global variables.
And whoever youtuber that is, he/she is just teaching bad code.
^ - and just so you know OP, all of this is documented under scope - a concept which is good to teach, but not well practiced in Lua. (https://developer.roblox.com/articles/Scope)
Actually the youtuber who is teaching bad practices is EppoBot, way to go lol.
Actually the youtuber who is teaching bad practices is EppoBot, way to go lol.