"Riches do not profit in the day of wrath, but righteousness delivers from death"
This is referring to the Day of Judgment – the time when God evaluates your life. Righteousness is not what you stayed away from but what you accomplished in terms of loving God or loving others.
Were you able to demonstrate your love for God through acts of faith? Too often people think of righteousness as negative things or what was not performed.
It is the righteousness of Christ that will deliver us from death on that day; the righteousness that comes from faith as Paul proves in Romans 3 and 4; the righteousness that only comes from obedience to the Word of God out of faith.