What is the ideal way to make part destruction?

Should’ve asked how to make a part vanish when touched! I’m not sure if I can help in the most efficient way because I’m not great with parts, but I do have a script that can make a part explode when it’s touched, if that helps.

`local` `delayTime ` `=` `3` `-- How long (in seconds) to wait after an explosion.`

`02` `local` `currentlyDelaying ` `=` `false` `-- Don't touch this.`

`03` `script.Parent.Touched:connect(` `function` `(hit)`

`04` `    ` `if` `currentlyDelaying ` `=` `=` `false` `then`

`05` `        ` `local` `exp ` `=` `Instance.new(` `"Explosion"` `, script.Parent)`

`06` `        ` `exp.BlastPressure ` `=` `500000` `-- The pressure of the explosion`

`07` `        ` `exp.BlastRadius ` `=` `4` `-- The radius of the explosion`

`08` `        ` `exp.DestroyJointRadiusPercent ` `=` `1` `-- The radius of where joints are destroyed upon impact`

`09` `        ` `exp.ExplosionType ` `=` `Enum.ExplosionType.Craters ` `-- What type of explosion do you want? Craters, CratersAndDebris, or NoCraters.`

`10` `        ` `exp.Position ` `=` `script.Parent.Position ` `-- The position of the explosion`

`11` `        ` `exp.Visible ` `=` `true` `-- If the explosion can be seen`

`12` `        ` `currentlyDelaying ` `=` `true` `-- Sets currentlyDelaying to true so that the code will be ignored`

`13` `        ` `wait(delayTime) ` `-- Waits the delay time.`

`14` `        ` `currentlyDelaying ` `=` `false` `-- Sets currentlyDelaying to false so that the code will no longer be ignored.`

`15` `    ` `end`

`16` `end` `)`

Unions won’t work to well you can try it since roblox does constantly improve there union operations but for the best results you should do some math and divide the parts

I am afraid this is not it either, as, the explosion instance, in order to create such an effect, would need multiple parts to make them launch, unless you are suggesting I make the map with a huge ammount of bricks, which is one of my options. I meant, however, not to launch parts, but instead to partially delete them in order to make it seem “dug”. Something around the lines of creating a crater.

I see. I’m afraid I won’t be able to assist you then, please accept my sincere apologies & hopefully you’ll find the guidance you are looking for! Blessed be!

1 Like

When I mentioned unions I was refering to using simpler shapes. So, instead of using a sphere, for example, I would use something like a uniform polyhedron. Something around the lines of this:

Would it cause better performance?

I appreciate the advice, in advance, and I will soon start on the method with math.

Not to sure, I’d imagine it will since it has to create less triangles, the problem with unions in general is that they have terrible hit collision and have a pretty decent high chance to fail, although when I messed with unions it was a few years ago; I know roblox made many improvements to real time union operations recently, it gets expotenitally more expensive if ur unionining a union aswell

If the explosions are somewhat consistent, you can have a set of varying explosion hole meshes. The sizes aren’t important as they can be stretched, squashed, and resized depending on explosion power. Then you need to do some annoying math to get it fit into the part surface. This is basically done by building 4 parts around it.

After that though, you get destruction holes without the annoyances of CSG performance and other conflicting issues like possible jank collisions.

Added benefit of course is that textures will still work on it along with materials as long as it’s properly uv wrapped.

Doing something like creating a hole within a hole would cause issues with this or slightly offset from other holes

You can slightly increase the size of the hole if that happens as a caveat, holes next to it will work fine.

Or just go the rouge method and voxelize a chunk of the part and cut a hole out of it in that manner.

Oh, yeah, this is something I had not considered, as well.

Hmmm, my problem with this method you suggested is explosions that hit the corners. It seems somewhat hard to manage in that regard.

I am confusion.

You should look into Mesh Deformation. Skinned MeshParts are live!
This would be so you could have a Mesh block, then deform it when a hit is detected.

Hey, I apologise for the very late answer. How would this work?

I’ve never used it, you may want to search it here, in the create.roblox.com site (or the older developer.roblox.com site) or on YouTube tutorials.

I know it deals with creating a deformable mesh that has ‘bones’ in it to create flexible joints that can move and animate like fabric.

Oh, I see, that is fine. I will definitely look into it!

If you go the union route then this video might help

1 Like

This is not exactly what I am trying to do.

I am trying to make a hole or a dug out sphere in a part. Doing this with unions is pretty easy - the only problem is that it causes a lot of problems in the long run. With an abundance of unions and with attempts at unioning and union multiple times, performance becomes an issue. I am not sure if, somehow, I can ease these problems?

Your correct that if you union with balls and cylinders then its a lot slower and if you keep unioning the same parts over and over can also get over complicated and slow the union operation

Because Roblox does not give us the ability to edit vertices of meshes like unity Unity - Manual: Example: creating a quad

The only options we really have are

  1. use the terrain Scripting Terrain

  2. to make are own custom meshes with wedges Mesh Editor Plugin

  3. mesh deformation roblox: playing with mesh deformation - YouTube

  4. voxel based game like Minecraft

Out of all the options the terrain option is most likely the most easiest and also most optimal method but I’m guessing that’s not what you want

Unions are most likely the slowest method


I am not sure as to what I want honestly. Lately I have been feeling like Terrain is slightly restricting in other departments aside from destruction. Right now, I am exploring a bunch of options to stick to what is better.

Scripting terrain is obviously easier. I am only slightly conflicted in terms of style, but I am trying to figure that out.

That plugin is really cool. Can you somehow script on it?

Is it possible to script mesh deformation?

Voxel based is what I am trying to experiment with at the moment. I am having a bit of a hard time but progress is being made!

Yeah, I guess unions arent cut for the job.

the plugin is open source so you could use the source code to make it script able https://www.roblox.com/games/3083823456

if you go with the voxel style then maybe this video can help you optimise your voxels

1 Like

I just came across this when searching for something else, a pretty step by step tutorial: Roblox Creator Documentation