This is because you are using the or
operator incorrectly.
On line 36, you put: if msg == Prefix .. "kill all" or Prefix .. "reset all" then
. That would always be true, no matter what.
The if
statement works like this:
If the value between if
and then
is truthy then it will run the code, otherwise, it won't. The only non-truthy values are false
and nil
All other values, like strings, tables functions, (even if they are empty, or the number is 0) are truthy
msg == Prefix.. "kill all"
- that is fine, due to the fact that if msg wasn't the prefix followed by "kill all", the value will be false, which is a non-truthy value, so it will work as expected. "#reset all" is always a truthy value because it's a string, and since you didn't put msg ==
in front of it, it doesn't evaluate whether msg is #reset all, which would return true or false, it would just read the truthy string value and decide that since it's neither false nor nil, it executes the code.
The short answer is that you have to put "msg ==" every time.
1 | if msg = = Prefix .. "kill all" or msg = = Prefix .. "reset all" then |
Also, my 100th answer! Hooray!