How to delete a raycast as soon as it hits a object?

How exactly could i make it so when a raycast hits an object it doesn’t go right through it with the first entity option. I am going to make it so that other players can see eachother shooting by i cant have it so that the player can see shots through the walls.

Hi @Granted,

If I understand what you are looking for, maybe use a filtered by tag raycast? So you accept raycast results only against certain objects, and not through others (walls).

1 Like

what i mean is the raycast line goes through everything and other players can see it. I need it so when the raycast hits a wall or object it doesent go any farther than that first object

If you use raycastFirst it stops at the first hit, but you have to make sure you draw your line with result.point as end point.