I just got a DIY kit quote for solar and it's ~$18,000. That would mean a contractor installing is at least $25,000 if not more. That's a big chunk of change upfront.
Even having the money, most people that install solar panels, and don't do it just for idealistic reasons (fighting climate change, etc), expect to save more money than they spend in the long run. Well, depends of the specifics of course, but it might take years, even decades to recoup that initial expense. Even if you have the cash, it might not be worth it.