Jesus responded with a challenge: "follow me."
Hundreds of years before, a psalmist threw his head back and groaned. "Why do the wicked renounce God, and say in their hearts, 'You will not call us to account'?" (Psalm 10:13)
The wicked seek their own gain. But while they are pursuing what they want, God's ear is inclined to the helpful and orphan.
O Lord, you will hear the desire of the meek; you will strengthen their heart, you will incline your ear to do justice for the orphan and the oppressed, so that those from earth may strike terror no more. (Ps 10:17-18)
Unless our goals are melded with God's, we pursue our dreams selfishly. The God of the universe cares for the meek and the oppressed.
That was Jesus' message to the rich ruler as well: Shed your own goals and follow mine.
For the ruler, this was too great a price for eternal life. Obviously his wealth was his dream. Eternal life was more of an add-on, a nice medal to decorate the uniform. He walked away from Jesus.
He forgot what we must never forget:
The Lord is king forever and ever (Ps 10:16)