HJoints with stript

Hello, I have a rope and a player which both have rigid bodies, but I want them to connect on contact. I know how to use the Hinge Joint component, but the 2 rigid bodies connect when I press play. That is why I need to write it in the script so they can connect on contact instead of right when I press on play. I looked around for help, but couldn’t find anything, if someone can give me a hand!