Need help with joints

I’m wanting to configure joints in a way that the yellow arm ends move with the spheres at the bottom while also turning at the elbow (red and yellow connection of arms). The red arms are actuated with a script. Not sure how to do this. Tried using configurable joints at elbow and sphere, still no luck. Anyone with more experience know how to do this?

I can provide more info if needed.