The Messenger of Allah ﷺ said, "When a person dies, their deeds come to an end except for three, an ongoing charity, knowledge that continues to benefit others, or a righteous child who prays for them."
أن رسول الله ﷺ قال: إذا مات الإنسان انقطع عنه عمله إلا من ثلاثة: إلا من صدقة جارية، أو علم ينتفع به، أو ولد صالح يدعو له.