They had disobeyed God while Noah was building the boat, but God had been patient with them. Eight people went into that boat and were brought safely through the flood.
Because Noah had faith, he was warned about something that had not yet happened. He obeyed and built a boat that saved him and his family. In this way the people of the world were judged, and Noah was given the blessings that come to everyone who pleases God.
And during Noah's time, God did not have pity on the ungodly people of the world. He destroyed them with a flood, though he did save eight people, including Noah, who preached the truth.
Don't forget that the Lord is patient because he wants people to be saved. This is also what our dear friend Paul said when he wrote you with the wisdom that God had given him.