What do you want to achieve? Keep it simple and clear!
I would like to make a wallbanging script that works well for my fps game.
What is the issue? Include screenshots / videos if possible!
I can’t think of how I would make wallbanging.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried making it but I can’t really think of how to do it so please help.
I don’t exactly know what you mean, but here you go.
Wallbanging is when bullets penetrate a wall via hitting a weak point, but to keep it simple we’re going to be simulating weak points by thickness and material (if your game uses the built-in Roblox materials).
If a bullet collided with a brick wall this thick:
This image represent the principle pretty good. It’s just ray that comes out of gun in direction where mouse is positing, if it hits object then another ray is casted, coming out of end position of first ray (actually it’s not end position, just end of rendering for ray) to a starting position, basically inversed ray and ray should hit the same object, but from opposite side. So if we going to count distance between these two hits and it’s going to be smaller then max thickness for wallbang then we cast third ray with exception of object that was hit by first two rays and “bullet” pass through it.