Raycast layer problem

so in the following code my raycast will not hit anything…however if I remove that '8’which is the layer number it will work perfectly…only it will collide with every object on screen:`


so if someone could tell me whats wrong with my layers, or maybe my code thx in advance

Layer masks are not quite so simple as putting in the layer number. I would suggest using the LayerMask class and adjusting via the inspector.