Actually, if you just say "it doesn't work well when there's a lot of yelling", that's basically a true statement, even if the only reason is the script you added. ;) But it doesn't work to just say "I put this script there because I, not the computer, am in charge of letting you play the game"?
Depends on what you mean by "works". If you want it to have any effect whatsoever, you have to follow through and actually turn off the game. And you'll have to do so until the lesson sinks in. And you'll have to deal with the kids that are crying and idle in the mean time. And they'll probably resent you for that rule because they aren't able to identify with it.
None of the above is a bad thing or an insurmountable obstacle, but there's nothing seriously wrong with making the computer take the blame either. In my opinion, it ends up teaching the kids to be considerate to others (even if it's just a computer), with less suffering all around. YMMV, etc.