Help with Grapple Mechanic

I had a bit of an issue with a game i am developing. I have successfully added a “swing” or “grappling hook” mechanic, however, I had one minor issue.
How would I make it so that the rope shrinks the longer the player is holding the swing button? The grapple I have is “stiff” if that makes any sense. Similar to the “spider swing” game on android. I’ve tried some y-axis shenanigans, but that hasn’t worked.