Updated script:
Notice at the end when I grab the ring to scale that it scales and translates. This is because the control has been offset from the joint to make it easier for animators to select, thus the object pivot is no longer in sync with the new position. I don’t think that is the case with your leaf joints though. I think this should fix it!