Yes, the truth is it is not that easy because it depends a lot on the personality of the child or adolescent, it is always a problem, because you cannot talk to them through threats because it is worse, I think we have to talk to them and make them feel very important , give them Responsibility for their thoughts, treat them like adults, make them see that they are not children and that we are giving them the importance they require, it is not easy.
This might still work with a child but having a conversation with threats makes no sense because if you scare a child with something you need to show that you will stick to your words. But often parents just scare the child to stop them from doing something bad and then feel sorry about punishing them. As a result the child sees that it does not work and stops taking it seriously.
With teenagers it is even more difficult because they are growing up and start to believe they have the right to manage their own lives. In this case they will treat your words even more superficially. When it comes to students these are already independent people who will make decisions on their own. So it makes sense to just talk to them and share your opinion. If they agree with you they will listen and if not they will learn from their own mistakes.