You need to pay more attention to where your 'end's go.
if this == that then
doThat()
elseif this == theother then
doTheOther()
else
WhatDoIDoNow()
end
Notice there's only one 'end', after you've tested all the conditions you're interested in.
I've taken a crack at structuring your code correctly. It's untested, and there seems to be a lot of probably unwanted infinite loops, but I'll leave your logic for you to work out.
Spoiler
local function centerText(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
write(text)
end
while true do
term.clear()
term.setCursorPos(1,1)
print("Choose your color!")
print("Red, Blue, Yellow.")
input = read()
print("")
term.setCursorPos(1,1)
if input == "red" then
while true do
term.clear()
print("On/Off")
print("")
input = read()
term.setCursorPos(1,1)
if input == "on" then
term.clear()
rs.setBundledOutput("back",colors.red)
print("Red Activated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
elseif input == "off" then
term.clear()
rs.setBundledOutput("back",0)
print("Red Deactivated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
end
end
elseif input == "blue" then
while true do
term.clear()
print("On/Off")
print("")
input = read()
term.setCursorPos(1,1)
if input == "on" then
term.clear()
rs.setBundledOutput("back",colors.blue)
print("Blue Activated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
elseif input == "off" then
term.clear()
rs.setBundledOutput("back",0)
print("Blue Deactivated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
end
end
elseif input == "yellow" then
term.clear()
while true do
term.clear()
print("On/Off")
print("")
input = read()
term.setCursorPos(1,1)
if input == "on" then
term.clear()
rs.setBundledOutput("back",colors.yellow)
print("Yellow Activated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
elseif input == "off" then
term.clear()
rs.setBundledOutput("back",0)
print("Yellow Deactivated")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
end
end
elseif input == "debug" then
while true do
term.clear()
term.setCursorPos(1,1)
print("Insert Password:")
term.setCursorPos(17,1)
input = read("*")
if input == "bacon" then
term.clear()
term.setCursorPos(1,1)
print("Password correct!")
os.sleep(1)
term.clear()
break
else
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!")
sleep(2)
end
end
else
print("DA FUQ?!!?")
end
end
--term.clear()
--centerText("What the hell are you on about?")
--os.sleep(2)
--end
--end
--end
Edit: Text editor did something weird to my spacing.