Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is greater than 3 but less then five?

Asked by 8 years ago

Hello, just a quick little question. Code first so you understand, this is the bit that gets an error.

lvl.Value >=3 < 5

What this is meant to do is that it will run something only if lvl.Value is more or equal to 3 but is less than five. When ever I run this it gives me this error, "attempt to compare boolean with number" If you can help that would be appreciated.

1 answer

Log in to vote
1
Answered by 8 years ago

From what i understand you are trying to fire a function once the criteria is met. IF that is the case then you're going about this wrong. In order to do what your trying to do you will need to use a condition. A conditional statement is basically asking your script if the criteria true or false. So to you would have to do something like this.

if lvl.Value >= 3 and lvl.Value < 5 then
    --code here
end

This is asking if lvl.Value is greater than or equal to 3 ANDlvl.Value is less then 5 then fire function. Once you get the hang of conditions they become very helpful.

Ad

Answer this question