When a person dies all his deeds come to an end except 3:
1. Sadaqah jariah
2. A righteous child who will pray (for parents)
3. Beneficial knowledge
(Hadith ~ Sahih Muslim)
Abu Huraira reported: The Messenger of Allah, peace and blessings be upon him, said, “When the human being dies, his deeds end except for three: ongoing charity, beneficial knowledge, or a righteous child who prays for him.”
Source: Ṣaḥīḥ Muslim 1631
Grade: Sahih (authentic) according to Muslim
عَنْ أَبِي هُرَيْرَةَ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ إِذَا مَاتَ الْإِنْسَانُ انْقَطَعَ عَنْهُ عَمَلُهُ إِلَّا مِنْ ثَلَاثَةٍ إِلَّا مِنْ صَدَقَةٍ جَارِيَةٍ أَوْ عِلْمٍ يُنْتَفَعُ بِهِ أَوْ وَلَدٍ صَالِحٍ يَدْعُو لَهُ
1631 صحيح مسلم كتاب الوصية باب ما يلحق الإنسان من الثواب بعد وفاته