I dont really list names of things but im not sure if this is the way you can do it.
if child.Name == "Brick3" or "Brick2" and "Brick4" then
I'm guessing your question is more about how to chain conditionals.
You need to explicitly state each condition. Every or
and and
is a divider that splits up your conditions. Right now, your condition is
if child.Name == "Brick3" or "Brick2" and "Brick4" then
but it is interpreted as
if (child.Name == "Brick3") or ("Brick2") and ("Brick4") then
where the conditions in parenthesis are evaluated first into booleans, and then the entire statement is evaluated. In Lua, strings are always evaluated as true
. This means that "Brick2"
and "Brick4"
will always be true, so this entire condition will always be true. That is not intended behavior, so we need to check if child.Name
is equal to each of the strings instead of attempting a shorthand like this.
if child.Name == "Brick3" or child.Name == "Brick2" and child.Name == "Brick4" then
Now, your condition will never evaluate as true
. A quick look will reveal that this condition is checking if child
has a Name
equal to two different values. This is not possible. I suggest reforming your condition so it makes more sense.
ononono you'd have to make it exact
so like this:
if child.Name == "Brick3" or child.Name == "Brick2" and child.Name == "Brick4" then