How would I create a claw machine?

hey! i’m currently working on a claw machine game for my uni project. do you mind sharing on how you made the grab & release thing work? i don’t quite understand how to make it work.