Exodus 4:31 KJV
And the people believed: and when they heard that the LORD had visited the children of Israel, and that he had looked upon their affliction, then they bowed their heads and worshipped.
Exodus 5:21 KJV
And they said unto them, The LORD look upon you, and judge; because ye have made our savour to be abhorred in the eyes of Pharaoh, and in the eyes of his servants, to put a sword in their hand to slay us.
What a difference in just one chapter.
The people believe and worship
The people bewail and worry
We find the same easy switch in people still today. When things look hopeful they are quick to call themselves believers and put on a show of worship. They want; they need something. If it looks like this particular person has an "in" with God to get it for them then they are "all in". But if circumstances change the spirit of these so called believers changes. They were in this to win this. If winning isn't in their future then they are out of here and over there.
God very often allows the circumstances to change in just this manner and expressly for the purpose of weeding out the shallow believer whose only interest is what he gets from God.
Be in it to the finish. Finale or failure, choose God. Do so and you will find that, though there appears to be many failures along the way, the finale is victory for the followers of God.