Disclaimer: this a mundane implementation of a basic dampened spring (can be made better):
Also, you could use Physics Constraint component instead:
Physics Constraint
No script is needed here and you’d get more control. Or use the new Physics Control plugin.
Physics Control