How to enable/disable input using raycast

Ive been tweaking with the graphs still cant make it work. can you give me an example graph.