Hello! I was trying to make a gun with raycasting, and I quickly realized that when the gun goes into the wall, you can shoot through the wall, no matter how thick the wall is. Im trying to make a proper gun that wont shoot through walls.
I already tried setting the parts to CanCollide true, but if I do that, then the players can go through walls sometimes, and it’s also very glitchy.
Try making it First-Person, If a Player Is in 3rd they can legit put an item/tool through the wall and if it has something that can summon Bricks or Bullets in this case, it will go through the wall
Could you Raycast from the player’s head or torso as a check?
local isObjectBlocking = true -- This would be your Raycast result from the player head / torso
if not isObjectBlocking then
-- Shoot from the gun
end
Here I assume the issue would be that the gun’s muzzle is being Raycast from - hence when the gun collides through an object the player can shoot ‘through’ the wall.