My mentor when I started teaching would say "Obedient children are happy children" but what she meant by this was that you need to create conditions where following the rules, and doing what's asked makes sense to children. Where it's achievable. Because at some level nearly always kids want to do what's "right" -
This is true even of adults. We like to hear "good job, you did it right."
So a child who keeps getting in trouble is probably even more miserable than the adults who are mad at her.