--Out here, Alpha will be retrieved from the global scope
if On == 1 then
local Alpha = 200
--Alpha exists here, as the above local variable. Once this block ends, Alpha is gone.
elseif On == 0 then
local Alpha = 1
--This Alpha is different from the one above, and only exists here.
end
--Statement block has ended, all local variables in the block are now out of scope, thus Alpha is once again from the global scope.
What you want to do is make sure your local Alpha value is available to the scope above the if statement block:
--Alpha is now a local value to this scope and all below it, initially nil (note that you don't need to set its value to make it nil)
local Alpha
if On == 1 then
Alpha = 200
--We've now set the local Alpha value from above this to 200
else
Alpha = 1
--We've set the local Alpha value from above this to 1
end
--Either prints 200, or 1 depending on how the above statement evaluated
print( Alpha )