Getting the wrong result from script

I'm trying to do a conditional IF branch with the following conditions:

IF Actor 2 has poison state,
OR Actor 2 has sleep state,
OR IF Actor 3 has poison state,
OR Actor 3 has sleep state,
OR IF Actor 4 has poison state,
OR Actor 4 has sleep state,
DO this
ELSE do that

To do this, I put this statement into the Script area of the conditional IF, in the event page:

if ($gameActors.actor(2).isStateAffected(4) || $gameActors.actor(2).isStateAffected(10) || $gameActors.actor(3).isStateAffected(4) || $gameActors.actor(3).isStateAffected(10) || $gameActors.actor(4).isStateAffected(4) || $gameActors.actor(4).isStateAffected(10));

However, it never seems to evaluate to TRUE, even when those actors definitely suffer from those states.

Kinda hoping I've made an obvious error here. Can anyone see where I've gone wrong?
Does your script have that semicolon at the end, because that shouldn't be there. Also, I don't think the if part shouldn't be in that particular script. Try this:

$gameActors.actor(2).isStateAffected(4) || $gameActors.actor(2).isStateAffected(10) || $gameActors.actor(3).isStateAffected(4) || $gameActors.actor(3).isStateAffected(10) || $gameActors.actor(4).isStateAffected(4) || $gameActors.actor(4).isStateAffected(10)
Did you use conditional branch for the script? If so, don't put 'if' statement. Just remove the if and it should be working.
Thanks guys! Managed to get it working.

Original thread: https://forums.rpgmakerweb.com/threads/getting-the-wrong-result-from-script.103492/