Im trying to make a gun system but i dont know how to make piercing, can someone explain how?

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a piercing system for my gun, but i cant seem to find out how
  2. What is the issue? Include screenshots / videos if possible!
    I havent really made the entire gun yet, sadly
  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    I havent really seen any solutions to help me

How would i be able to make a piercing system like FE guns (but on the server)

2 Likes

to make bullets penetrate walls/players, first of all you need to be using rays(whether you use them to simulate a projectile or just hitscan doesn’t matter)
next, on an impact with a surface, calculate a position far on the other side of the wall

has to be FAR if you care about piercing through very thick parts(not longer than workspace:raycast though, so like 600 studs, it won’t matter if your parts are reasonable thickness) because otherwise the second ray would start inside the hit part and then not be able to hit anything

cast a ray directly backwards from that position, with a whitelist so it can only hit the part the first ray hit
the point that the second ray hits is where the bullet exits the surface, so just cast a ray/move the projectile and continue to move it

2 Likes

I meant like, piercing players not walls (like it can hit 1 + Piercing amount players but stops when hitting a wall)

Also, sorry for not properly explaining, this is my first post so i didnt really know how to begin a topic

1 Like

for players only its a lot more simple especially because you don’t care about the depth or the exit pos of the bullet
just store a number for each bullet fired(ex. PierceMax)

when a ray hits a player:
subtract 1 from the number,
fire another ray from the position the first ray hit(make sure to ignorelist/blacklist the character you hit),
repeat(fire another ray, hits another player, etc etc) until PierceMax reaches 0

1 Like

So like, just fire another ray going the same direction?

yeah, just keep firing rays(or multiple rays if you’re simulating projectiles) in the same direction and ignoring the player you hit

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.