I heard Messenger of Allah ﷺ as saying: When Allah intends to chastise a people, He chastises all of them then they would be raised according to their deeds.
سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ إِذَا أَرَادَ اللَّهُ بِقَوْمٍ عَذَابًا أَصَابَ الْعَذَابُ مَنْ كَانَ فِيهِمْ ثُمَّ بُعِثُوا عَلَى أَعْمَالِهِمْ