VoxBreaker | An OOP Voxel Destruction module

And also I’ve just found a bug where destroying all voxels of a part will make it undestroyable when it resets, so be wary of that. Ill include all bugs I find in the original post.

1 Like

UPDATE

2 Likes

Another small update, I’ve fixed parts stacking on the x and z axis. Expect better performance (maybe?)

1 Like

Hello! I wanted to implement your destruction system on a moving model (a train based on body velocity) and i was wondering if this is possible to make?

1 Like

No way! You made Unions viable! I’ll use this in a game eventually, its just that all my building systems (what I’d probably use this plugin for) are more simplified.

1 Like

Yep, thats no problem at all. In fact, the moving projectiles in the test place are all using bodyvelocity. So it should work fine.

Just came across this gonna use it for destructible ships in my pirate game (cannon balls hitting ships e.t.c.) thank you!

1 Like

Just a quick question but is the .CreateMoveableHitbox only meant to be used on the client. Asking because im trying to have it run on the server and im having difficulty getting :CreateHitBox to not instantly voxalize the entire part.

The functions should be usable on both the server and the client. There is an issue with runservice that i have yet to correct, but it should work. But for the issue with parts voxelizing instantly, that was the intention. But, if this becomes too much of an issue, I think ill add a :Start() function, so that the hitbox isnt immediately active.

Alright thanks. I also have one question. How do you get instance.new to create a part instantly. For me there is some kind of delay of it loading in I presume I have no clue honestly.

Im assuming your using it in a local script. Id like to avoid that if possible because id have to sync the physics of the destruction for other clients in my game.

In all honesty i have no idea whats causing the issue for you. Ive tried it on the server and have run into no issues. And for using instance.new(), even on the server, it works immediately so i really dont know what the issue is.

Ah that sucks ill have to just try some other methods. My only guess if there are issues with big parts being voxalized but even that shouldn’t cause too many issues. I did try it on another place same map just without all the other mechanics of my game. And couldn’t notice anything. Anyways thanks for all the help.


I got a video of it in action. As you can see it slowly loads it part by part (This could be a roblox studio exclusive bug and I hope so, but for some testing I’ve done before hand doesn’t seem so) It doesn’t seem as bad as it is because I’ve done a band aid solution where I wait a bit before I actually change the transparency of the original block.

My main concern is when there are more players than just me.

My only guess is the server is overloaded with creating and destroying and all the math that it slows down actually showing the parts themselves to the the player. My only guess is to change it to client side and replicate all the physics and such to the other clients. If you have any other guesses it would be greatly appreciated.

I would just like to preface this by saying that ive done all my testing with my computer with an RTX 3060 ti, intel I7 processer, and 16 gigs of ram. With that being said, it is possible that running the system on the server for me is far faster than lower end devices. And, as you said, it could just be a studio issue. If im not wrong, I believe running the server within studio playtesting uses your hardware to run the server. So it could be causing some hiccups.

One suggestion i have is to increase the minimum voxel size. Like ive said before, the more voxels you have, the laggier its gonna be, so with larger hitboxes i always recommend increasing the minimum size. Though, it seems like that might not be the issue for you, so I couldn’t really say what a perfect fix for this is. Id say play around with smaller hitboxes and see if that works.

I’ve found some work arounds as in giving it a delay before changing transparency and increasing the voxel size. Thanks for the suggestions but still this really makes me curious as to just how jujutsu shenanigans does it. Although I doubt he would be so willing to reveal his secret lol.

Last thing thanks for your system specifications ill keep that in mind from now on. I was wondering if I was doing anything wrong when I was watching your example videos. The only part that still confuses me is in the test place I have no issue at all with your module. For now this is all my questions thanks a lot for your time!

2 Likes

Hi I was messing around with your module and it is really good but I have an issue where if I perform destroying the voxels on a server script the parts don’t reset to their original form but on a local script they do is there a way to make it so they also reset on back to normal on a server script and sorry if this a dumb question

I havent seen this in my testing, but i will look further into it. The module has several issues right now and i will be updating it soon

I also have one suggestion if at all possible but can you implement some system to disable decals or surface guis when a part is voxalized. I had to create my own make shift solution that works as of now but it would be nice to have it be a built in feature.

2 Likes

This is an amazing resource! Would it be possible to create a GitHub repository accepting pull requests? I’d like to contribute to slightly improving performance and using newer features in the Luau language.

1 Like

Didn’t consider it, but now that you’ve reminded me, I’ll work on setting one up tomorrow, along with some updates to the module.

2 Likes