Can someone tell me if I add something like local asd = nil
in a function
, then end the function
and try doing local asd = game.Workspace
, would they interfere with each-other?
Example script:
function Random() local asd = nil end local asd = game.Workspace
Sorry if this isn't really a good question for ScriptingHelpers, just curious.
Your answer is no, they won't interfere with each other. Anything created with local before it will basically only be able to be called from that scope.
function Random() local asd = nil print(asd) -- Nil end local asd = game.Workspace print(asd) -- Workspace ---- local derp = "derp" function showDerp() local derp = "hi" print(derp) end showDerp() -- Hi print(derp) -- derp --However if you do something like this: local derp = "derp" function showDerp() derp = "hi" -- No local before it, the script believes we are editing the one outside the function's context print(derp) -- derp end print(derp) -- derp