Hi. I recently started to practice on my Lua books and I'm a very beginner scripter. I made the line of code below to see if I was getting the hang of statements, and I guess I really wasn't. I want it to change the color of "Door_1" if the equation is correct. I got an error message saying it expected a "= " near else which really confused me.
a = 5 b = 10 e = 15 if a + b == e then print("Passcode Correct: Unlocking Door.") Game.Workspace.Door_1.BrickColor = Light Green else print("Passcode Incorrect: Door Locked.") end
Again, I am a very beginner scripter and this may seem ridiculous to some of you, considering it's such an easy thing that I most likely messed up. I found it a better idea to come here, and as the advanced scripters rather than just going on Google and searching for a way to let me script run because we'll, I need to know what I did wrong just not correct it.
-- You aren't setting the values and you're using them at the top, so there's no reason not to make these vars local local a = 5 local b = 10 local e = 15 if a + b == e then -- I don't know if your formatting messed up? print("Passcode Correct: Unlocking Door.") game.Workspace.Door_1.BrickColor = BrickColor.new("Bright green") -- You didn't put BrickColor.new("string") -- Also there is no 'Light Green' or 'Light green' else print("Passcode Incorrect: Door Locked.") end