How can I make a Gun Preventing Glitching in a Gun System?

Greetings, I was trying to make a gun scripts for my group, but most of the players are glitching it and I don’t wanna ban them all. I would like to make it like you can not shoot if your barrel is inside the wall or you are shooting over wall. I have no idea how could I make it so if someone could help me how, it would be great.

Indeed my grammar isn’t the best one.

Thanks in advance!

1 Like

Maybe have a Raycast fire from the torso to the target as well, so if an object is in the way then set the gun to shoot at that spot instead of through the wall.

The reason it glitches is because the firepart is past the wall and the mouse isn’t hitting the wall.

Indeed, thank you. I’ll try this.

1 Like