There are two different aspects to this:
i) Consequences as a result of ordinary principle of cause and effect working in this world. For instance, when a person makes a decision in this world, that decision could be a huge mistake and may have consequences that even his generations have to bear. This is not a special divine law rather working of normal prinicple of cause and effect in this world.
ii) Consequences faced in this world as a result of some sin committed (often called as Makafat-e-Amal). There is no special divine law in this regard, but sometimes it can happen that a person may face certain consequences for his sins in this world and vice versa. This is based purely on our observation, not on some divine information. This observation negates the hypothesis that children of a person also get punished in this world because of the sins of their parents or ancestors. This is also againts the ethical principle of reward and punishement. This is however possible that in accordance with the principle of tests and trials on which this world is built, some families may be facing the test of patience (‘sabr‘) and some may be facing the test of gratitude (‘shukr‘) as a whole through generations. If something like this happens, then it may be because of the test and not because of the punishment for the sins of the ancestors.
As far as divine information is concerned, we have been told for every individual, his makafat is the day of judgement where he will be punished/rewarded for his deeds. And for nations, their makafat is this world. This automatically ensues that Allah does not punish children for the sins of their parents at an individual level. It is only nations which are punished collectively in this world as a result of their sins/transgressions.
For the concept of maqafat-e-amal in detail, please refer to the videos of Ghamidi Sahab in the following thread:
Discussion 78504