That's because a child only sees and imitates what his parents do so it makes us as parents be careful when in front of them. We must be able to set a good example so that they see and imitate it for their future provision. If we can set a good example for them, they will surely understand and be able to distinguish what they can and cannot do. This will also prevent their children from doing something bad when they grow up. Children need the understanding to understand things so this is what makes us have to be able to explain everything properly and correctly.
Parents have their own choices but I am sure that parents do not want their kids to follow what wrong they do or did in their life.
Like if a father takes drug he would beat his son to death if he finds out his son is doing the same. Likewise - if the parents are addicted drinker they would not want their kids to do that, Having gambling trait in DNA is not correct - its a choice.