Initialize firstname outside of the parallel. Put local firstname
up at the top of your code, and change local firstname = read()
to just firstname = read()
, and do the same for last name.
You are creating the variable after you check whether or not it is nil, which is why it always returns nil. Similarly, when the function ends, firstname no longer exists, since it is called and created inside of the function. So it will always return nil. The top of your code should look like so
rednet.open("back") --Opens rednet on the back side of computer
local innerdooropen = false --Stuff to do with the airlock
local outerdooropen = false
local firstname = ""
local lastname = ""
And the other section should be as follows:
if firstname == nil then
print "Welcome to Obsidian Station!"
print "You must register before entering"
print "Please type your first name"
firstname = read()
if firstname ~= "" then
print("Enter your last name")
lastname = read()
print("You are now registered "..firstname.." "..lastname)
sleep(3)