1) Diversify their economy
2) Build up enough sovereign wealth to maintain their citizens standard of living after the oil has run out.
The first is very hard, because huge percentages of their population are completely disengaged from the economy. It's estimated that 30-40% of working age adults neither have a job, nor are looking for one. An unusually high percentage of those who have jobs work for the government, and somewhere close to 90% of non-oil jobs are held by foreigners. There is immense social and economic pressure against citizens of KSA getting private sector jobs. The biggest "employer" in the country is the yearly hajj pilgrimage, which isn't a lot.
The latter is incredibly hard because of the former. That 30-40% of the population that don't have jobs need to be fed, or they'll eventually revolt. And all of those government jobs cost a huge amount of money. And the fact that the citizens of KSA neither want jobs (apparently) and aren't properly trained for a lot of those jobs makes reducing the social services bill very, very hard.
If they can outrun the de-carbonization of the world, KSA will do okay. Maybe not as good as it was during the peak (if you were one of the few getting the benefits), but not terrible. If they don't outrun de-carbonization .... well, then I would recommend not being there when whatever happens, happens.