Is repentance from sins because of someone's death or something else invalid? No, it is valid; a person takes heed.
For example, a person takes heed if a friend of his dies at his age while he is sinful.
When reflecting, he thinks: What if I were with him? What if I were in his place? What if I died? On the contrary, he takes a lesson from it. That is why Ibn Mas'ud.
He says: The happiest of people is the one who learns from others, and others do not learn from him.
Try to take heed from others yourself, not that others take heed from you.
He cried, so on the contrary, a person is affected by this, and that is good.