We read about acts of the kings. If they did evil in the sight of God, they did not succeed. And their sins caused others to sin.
“In the third year of Asa the king of Judah, Baasha the son of Ahijah began to reign over all Israel at Tizrah, and he reigned twenty-four years. He did what was evil in the sight of the Lord and walked in the way of Jeroboam and his sin which he made Israel to sin.” (1 Kings 15:33-34 ESV)
If they did what was right in the sight of God, then He allowed them to prevail.
“Then the men of Judah raised the battle shout. And when the men of Judah shouted, God defeated Jeroboam and all Israel before Judah, and God gave them into their hand. Abijah and his people struck them with great force, so there fell slain of Israel 500,000 chosen men. Thus the men of Israel were subdued at that time, and the men of Judah prevailed, because they relied on the Lord, the God of their fathers.” (2 Chronicles 13:15-18 ESV)
But salvation is different. We cannot be saved by works. Nothing we do can ever be “good enough.” We are only saved by grace through faith in Jesus Christ.
“But when the goodness and loving kindness of God our Savior appeared, He saved us, not because of works done by us in righteousness, but according to His own mercy, by the washing of regeneration and renewal of the Holy Spirit, whom He poured out on us richly through Jesus Christ our Savior, so that being justified by His grace we might become heirs according to the hope of eternal life.” (Titus 3:4-7 ESV)
Thank you for showing us that we all fall short of Your glory. But even more so, thank you for saving us from ourselves. We are eternally grateful!