My raycasts keep on ignoring my characters and enemies can someone please help my with this problem

I have a small shooter ga!e that I’m currently busy making and in the game I gave the player the upgrade of using a laser, I used a line renderer to make the laser and in the update function I will cast raycasts every fra!e rate and where it collides I set the line renderer’s length to the raycast hit’s distance, simulating an actual laser but the problem is that the laser has to kill the enemy zombies and the zombies have a death function stored on them, all I need to do is to call it and I do so using an if statement

If(hit.collider.tag==‘Invader’)
Then it will send a message to call the death function on the zombies
But instead my raycast just goes through the zombies and it doesn’t trigger any death function
I checked and the zombies have collider’s and I made sure that their layers aren’t been ignored by the raycast but nothing works
The raycast still ignores the zombies
Please help me
Thanks in advance

Post code? A common/easy mistake with raycasts targetting layers is passing parameters as (ray, out hit, layermask, distance), when it should be (ray, out hit, distance, layermask) as both distance and layermask can be treated as ints - so there’s no error but the ray will hit the wrong layers and travel the wrong distance.