Children these days are able to understand and comprehend a lot more than the generations before them. If you talk to them and show them the consequences of their actions, they are more likely not to repeat the same mistakes again.
Another thing that helps is if as a parent you do not make the same mistakes also. Like if you tell your children that they should not lie, and you tell them the consequences then you should never lie also. As soon as they see you lying then the power of your words start to dissolve. If you want your children to develop good habits then you should be a good example and doing those things also.