They Believed God and it was credited to them as righteousness, meaning right with God.
And he (Abraham) believed the LORD, and he counted it to him as righteousness. Gen 15:6
"….By his (Noah's) faith he condemned the world and became heir of the righteousness that is in keeping with faith" (Hebrews 11:7).
By faith Enoch was taken up so that he should not see death, and he was not found, because God had taken him. Now before he was taken he was commended as having pleased God. And without faith it is impossible to please him, for whoever would draw near to God must believe that he exists and that he rewards those who seek him. Heb 11:5-6
The only type of righteousness in the entire Bible, is righteousness by faith.
For in the Gospel, the righteousness of God is revealed--a righteousness that is by faith from first to last, just as it is written. "The righteous will live by faith" (Romans 1:17).
And this righteousness from God comes through faith in Jesus Christ to all who believe. There is no distinction, Rom 3:22
What then will we say? That the Gentiles, who did not pursue righteousness, have obtained it, a righteousness that is by faith; Rom 9:30
And it is clear that no one is justified before God by the Law, because, "The righteous will live by faith." Gal 3:11
and be found in Him, not having my own righteousness from the Law, but that which is through faith in Christ, the righteousness from God on the basis of faith. Phil 3:9
The Bible teaches of an obedience of faith that leads us to act out on what we claim to believe.
through whom we have received grace and apostleship to bring about the obedience of faith for the sake of his name among all the nations, Rom 1:5
Abraham and Noah were declared righteous by God long before we see their obedience in offering Isaac and building the ark. Their actions were fruits of their belief.
Now let me ask you a question. If Abraham believed God enough to offer his only son for sacrafice and Noah believed God enough to build an ark that took decades, do you think God could trust that they they would continue to believe him when he said “trust in Jesus as savior?” I do not think there is any doubt they would. They trusted God and God knew their heart toward him. They were righteous, declared right with God by faith, just like we are when we claim Jesus as our savior. Just like us, no one could see their faith apart from their actions. It is obvious they really believed God, their works were fruits of their faith.
In the entire Bible there is only one way to be right with God, by faith, by believing God, trusting God and letting the obedience of your faith lead you....This is the heritage of the servants of the LORD, and their righteousness is of me, saith the LORD. Isa 54:17
Go HERE believer to learn more about your righteousness in Christ.