VoxBreaker | An OOP Voxel Destruction module

not really what i mean if the original part has a value it cant be reset if the created building which would be the wall . and the building was in front of walls of the map the wall of the map is destroyed and doesnt reset is what i dont want . I want the building to be the only one to not reset not the wall of the map

for some reason setting it to below 0 like -1 creates an error

Yeah I’m sorry, I have no idea what your asking.

should i show what i mean
like a video
from a game what i wanna replicate

Go ahead, would help me better visualize it

this might be little hard since they changed the game a bit

robloxapp-20240709-1805281.wmv (3.5 MB)
its a very blurry , I don’t want the wall I built to reset itself like the wall i destroyed that reseted @Bartokens

I’m even more confused now. What exactly are you trying to achieve? From everything you’ve told me it just sounds like you want a way for your parts to not reset, which is already in the module

now i kinda feel stupid, the built structure cant reset but the map can

Is this what you’re saying, I have a building system in my game. I don’t want anything created by the building system to be destroyed. Is this what you’re saying? If this is what you’re saying, just don’t give “Destroyable” attribute to built blocks.

Edit : I understand what you’re saying now. You want the built barricades to be able to be destroyed, but not regenerate. If that is the case, you can use 2 seperate modules of VoxBreaker, one for the barricades, and one for the normal buildings. The barricade module should be looking for a different attribute, and the reset time should be -1. The other module can remain the same.

for some reason -1 breaks my game which i hate

might be a bug. I’ll be updating the module in a day or two.

yeah thats what i meant the edit part

also can u do anything about the lag that happens everytime the voxel destructon first happens or is that just a me problem

1 Like

theres a bug where if you break a part with a materialvariant the voxels and the destroyed part will be reset to the default material without the variant

for some reason it says “attempt to compare table < number” any idea how to fix?

local collectionservice = game:GetService("CollectionService")
local damage = script.Parent.Configuration.Damage.Value
local Attack =nil
local attacking = false
local voxel = require(game.ServerStorage.VoxBreaker)
local editeddamage = damage
local debris = game:GetService("Debris")
local hitbox = voxel:CreateMoveableHitbox(0,script.Parent.Sword.ChopPoints.Size,script.Parent.Sword.ChopPoints.CFrame,Enum.PartType.Block)
	attacking = true
	local moveDirection = script.Parent.Parent.HumanoidRootPart.CFrame:VectorToObjectSpace(script.Parent.Parent.Humanoid.MoveDirection)

	if moveDirection.X > 0.2 then
		Attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animations.AttackRight)
	elseif moveDirection.X < -0.2 then
		Attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animations.AttackLeft)
		Attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animations.Attack)

	attacking = false



Thats another bug. Sorry for the update delays ive been a bit busy


that’s fine, i havent had any other problems with the module and this was just a minor one

how can i make a hitbox that enables from knockback performant
i made it so whenever somebody gets ragdolled usually from knockback it starts doing raycasts in the direction of movement
and if it finds a result it places a hitbox there but it makes my frames drop like crazy so idk how to improve it

Im expriencing a bug where sometimes the part thats being destroyed flashes