Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an explosion useless?

Asked by 5 years ago

I'm trying to make an explosion ignore certain parts meaning that those parts wont be affected whatsoever by the explosion.

I've tried this

explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = 0

but it still seems to make at least 1 part fall out of place.

0
You can anchor those parts buoyantair 123 — 5y
0
Yeah that's the issue though I need the parts to be not anchored because basically the explosion is caused from a rocket but I need it so that people can't destroy their own team base bricks but other teams can. Optimalpokemon123 37 — 5y
0
I could still anchor the parts when the rocket hits then unanchor then remake the joints but that's pretty hacky to be honest so would prefer not to do that. Optimalpokemon123 37 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

As of now, I don't think there is any way to tell an Explosion to ignore certain parts. What you can do, however, is use the Hit event to filter through all the parts that your Explosion "touched".

  1. Create your Explosion instance, and set the BlastRadius as you normally would.
  2. Set the Explosion's BlastPressure to 0 so it won't push any parts it hits.
  3. Connect a handler function to the Hit event on your Explosion. This will feel similar to hooking up a Touched event for a Part. You can also look at the example code on the page I linked above.
  4. Upon your Explosion hitting another part, use the part argument in the handler to decide whether or not to actually put force on it.
  5. Create your own BodyForce Instance and add it to parts you want to affect with the explosion. There is a good example of how to calculate the force and direction of this custom BodyForce in the LinkedRocketLauncher from Roblox.
Ad

Answer this question