And Noaḥ did according to all that יהוה commanded him.
Berĕshith (Genesis) 7:5 TS2009
See, I am setting before you today a blessing and a curse: the blessing, when you obey the commands of יהוה your Elohim which I command you today; and the curse, if you do not obey the commands of יהוה your Elohim, but turn aside from the way which I command you today, to go after other mighty ones which you have not known.
Deḇarim (Deuteronomy) 11:26-28 TS2009
Noah would have died with everyone else if he did not obey God. Because of his obedience the human race was preserved.