Due to the wickedness of the world, God destroyed the earth by a worldwide flood. Only 8 souls heeded the warning of God and were saved.
“By faith Noah, when warned about things not yet seen, in holy fear built an ark to save his family. By his faith he condemned the world and became heir of the righteousness that is in keeping with faith.” Hebrews 11:7
A hundred and twenty years before the Flood, the Lord by a holy angel declared to Noah his purpose and directed him to build an ark. While building the ark he was to preach that God would bring a flood of water upon the earth to destroy the wicked. Those who would believe the message, and would prepare for that event by repentance and reformation, should find pardon and be saved.
As with the door of the Ark, the door of mercy will be shut when Christ shall cease His intercession for guilty men, before His coming in the clouds of heaven. Then divine grace will no longer restrain the wicked, and Satan will have full control of those who have rejected mercy. They will endeavour to destroy God's people; but as Noah was shut into the ark, so the righteous will be shielded by divine power. Patriarchs and Prophets p. 98 EG White