I'm currently making an fps and I am stumped on how to proceed with preventing shooting through walls (sticking your gun through a wall then firing).
Currently I'm considering giving the gun a hitbox and preventing it from firing if the hitbox hits a wall (edit: INSIDE a wall), however, I have no idea how to do this - I've experimented with touched and I don't know how to properly use it to do this. Any help is greatly appreciated! Thanks.

4 comments
You could try casting a ray from the tip of the gun to your player's head, if it can't hit, it would mean they're shooting through a wall
I don't mean bullet collision detection, I mean actual weapon detection - the weapon itself has a hitbox and can't fire if it is stuck through a wall to prevent shooting through walls, where the tip would be on the other side of a wall.
yeah that's what i'm saying, you could try casting a a ray from the tip of the gun to your head. if there's something in the way, they're probably trying to shoot through a wall.
Ah, I see. Sorry, I misread your previous answer. I'll try this now.