I have made something like that before, maybe this helps.
https://wackytoaster.at/parachute/ragdollWalker.c3p
This part specifically keeps the character upright. It basically turns the body upright with a force that gets greater the further the character isn't upright. If your character stands still you might have to do something similar for the legs.
the ragdoll moves and is alive but it doesnt stand...