So.... I need a way to do a "if" thing for two values, this:
if RandomBall and Ball1BeingUsed == ?????????? then
The ???????????? is the problem, I mean, that RandomBall is a number value, and Ball1BeingUsed is a bool value, so they're two different value types. So that means how would I do that, I'm guessing I'll try a "and" like this "== 1 and false then" but I'm not sure it works........
Lol, you had it almost exactly correct. This'll work:
if RandomBall== 1 and Ball1BeingUsed == false then --You can change the '1' or 'false' if you need to
It doesn't matter how many conditions there is, which I think was your problem. You don't assign them both to the same value when you use "and", you're just setting up another condition. Hopefully you understand what I'm trying to say. Anyways, if you have any questions or problems, please leave a comment below. Hope I helped :P
I'm not sure what you're trying to ask here.
and
is a binary operator (meaning it works on 2 things). If the first operand is true
or truthy (that is, if it isn't false
or nil
), the second is returned, otherwise the first is returned.
or
is also binary, but is the opposite. If the first operand is not true
or truthy, the second is returned, otherwise the first is returned.
In your example,
if RandomBall == 1 and not Ball1BeingUsed then --This is what I assumed you meant. --First, it checks `RandomBall == 1`. If it is indeed 1, this becomes: if Ball1BeingUsed then --and if it isn't: if false then --Which obviously does nothing. --Next, if `Ball1BeingUsed` is `true` or not-`nil` then the `if` statement runs. Otherwise, nothing happens again.
Locked by alphawolvess, dyler3, TurboFusion, and adark
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?