How can I make a weapon that can shoot bullets through props.

I’ve searched for ages, and I don’t think there’s anything which shoots bullets through props, there are certain sweps (no longer uploaded sadly) that shot a trace through walls and such, but I’d like to use bullets if possible.

I’ve got no idea how to do it, I tried making a workaround int eh callback function but that just went terribly.

You mean bullet penetration?

Basically yes.

If you only wanted to make it go through ONE prop, you could use the self.Owner:GetEyeTrace().Entity and check if it’s a prop; if so, the bullet starts after the prop rather than at the gun.

You can put that in a loop to make it work with multiple entities.

Yeah, you would have to do something where if you detect a prop then you start a new trace behind the prop going on the path of the bullet, and keep doing those traces until you hit something that isn’t a prop.

Yeah but a trace doesn’t take accuracy into account.

[lua]local bullet = {}
– set up yer bullet
local traces = {}
function bullet.Callback(attacker,trace,dmgInfo)
table.insert(traces,trace)
end
– Fire yer bullet(s)
for _,trace in ipairs(traces) do
MyPenetrationFunction(trace)
end
[/lua]
You will then get a each bullet’s path in trace form sent to your penetration function (you could technically do the penetration in the callback, but if you’re using a gun that fires multiple bullets, if you fire another bullet in the callback, all other callbacks stop.)

Well done lexi.

Dude thanks alot for the code!!!

just one question, where do you put the code?

OK for everyone saying this is a dumb comment and you know the answer could you please tell me.
it isn’t helping me at all just saying this is dumb. im new to lua.

That code needs work you can just run it like that your going to need to find someone to make it work for you or do it your self

Never mind i got it!!!
i downloaded physical bullets!