print ("What is 5+10") while input ~= "15" do input=io.read() if input == "15" then print("Congrates") end if not input then print ("Wrong") return end end
It works, but it does not print "Wrong"
3 things: 1. No, this script doesn't work if it doesn't print "wrong" when the answer is wrong. 2. This is how its done:
print ("What is 5+10") Game:GetService("LogService").MessageOut:connect(function(Msg) if msg == "15" then print("Congrates") elseif msg ~= "15" then print ("Wrong") end end)
return
to return()
.Another solution could be:
print ("What is 5 + 10?") local i = 5 local o = 10 if i + o == 15 then print ("Congrates!") else print ("Wrong!") end ------These go together BTW :) if i + 0 ~= 15 then print ("Wrong!") end
But, that's the longer way to do it.
I'm assuming this is what you were asking.