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

Make Script check more than one value?

Asked by 10 years ago

Is it possible to make an conditional statement check two or more things? Like I have 4 BoolValues, and I want the script to check if all the 4 values are true, how would I do that?

1 answer

Log in to vote
0
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

Sure, just use the AND operator.

if boolValue1.Value and boolValue2.Value and boolValue3.Value and boolValue4.Value then
    print("All true.");
end

Of course you can check if the value is == true, but when that is not supplied it just checks to make sure it's not false or nil. And a boolValue's Value can never be nil (or anything else for that matter) other than true or false.

Ad

Answer this question