There are no specific laws against taking over someone's car payments, but there are important things that should be considered. If you take out a loan it must be paid. There are different reasons people transfer their car loans and while they make sense, there are issues that must be taken care of prior to the transfer.
When you sell your car, make sure you outright sell it and do not just transfer the loan payments. If you transfer the loan payments to someone as the price of sale, there is a chance the person can stop making payments or make late payments. Since the payments are in your name, these late and missed payments will show up on your credit report. This may seem tempting for the buyer because there is no hassle of getting a new loan or the possibility of higher payments, but it can end up hurting you.
If you take over the payments for a car, but the deed is not in your name, then when the car is finally paid off, the car will be in the other person's name, not yours. An example of when this might happen is if a younger sibling takes over the payments and buys the car from an older sibling. When the younger sibling finishes paying off the car, it will still be in the older sibling's name so the younger one has no legal claim to it. While it may seem convenient because you do not have to do the paperwork, it may be a bad deal for the younger sibling.
If you are still contemplating either of these situations, then you need to draw up a contract of some sort. While the contract may not be able to keep people from making late payments, if written correctly it does give you the right to sue for damages. Come up with contract terms you are comfortable with as the seller and make sure the buyer agrees to them. Have the contract signed and notarized and make sure both parties get a copy. This is a legally binding document that protects both of you.