Ninja Rope?

I was wondering how you create a ninja rope? Like when you press the mousebutton on a wall or a roof, and a string hits the wall and you can swing, kind of like spiderman.

I’m trying to create something like this, exept for that you shoot the rope with the mousebutton instead of space.

If you guys could help me, that would be great.

Thanks in advance.