How financial advisers to almost-in-bankruptcy people get paid?

I've read a couple of books by personal financial advisers where they tell terrible and sad stories of people that mismanaged their financial affairs to the point that they were facing judicial trials and bankruptcy. These experts then enter in the scene (generally recommended by third parties) with wise counseling that little by little take them out of the mud. But my question is how these experts get paid if at the beginning their clients have absolutely no way to pay them. Are they going to risk the value of their time, expertise and work to collect their money in the future "when the sky will be brighter"?