why wont this code work? I get no errors but when I try to type in the TextBox and click the button it keeps updating the first textlabel and not going down the list
It is that you use elseif, meaning that it only runs the code under those statements if the previous statements fail. Replace with just “if” instead but remember to close the previous if then statement by using an end.
Thanks, I can be clueless when it comes to scripting, the answer is always under my nose
I know that it’s unrealated to the problem, but an if
statement is checking whether the value between if
and then
is true. e.g When you print(1+1==2)
, it will print true. If the value between if
and then
is equal to true
, or in some cases not nil
, it will continue to the function between then
and end
. As a result, you do not need to check if a bool value is equal to true
in an if
statement.
e.g
if Box1 and not Box2 then
end
so i just remove the true’s and false’s and it’ll work?
now it doesn’t work at all, it broke
My post regarding the formatting of the if
statements was not a fix to your problem…
I was merely trying to help you understand the way LUA works a bit more and help you with future scripting.
You don’t take out the == true/false
unless you know that the value being compared is a bool value. Then you can distinguish between true and false using if Variable then
and if Variable not then
.