I heard the Messenger of Allah ﷺ saying during the Farewell pilgrimage: “No criminal commits a crime but he brings. (the punishment for that) upon himself. No father can bring punishment upon his son by his crime, and no son can bring punishment upon his father.” (Using translation from Ibn Mājah 2669)
أَنَّهُ شَهِدَ حَجَّةَ الْوَدَاعِ مَعَ رَسُولِ اللهِ ﷺ فَقَالَ رَسُولُ اللهِ ﷺ لَا يَجْنِي جَانٍ إِلَّا عَلَى نَفْسِهِ لَا يَجْنِي وَالِدٌ عَلَى وَلَدِهِ وَلَا مَوْلُودٌ عَلَى وَالِدِهِ