What is the best way to destroy everything? (smoothly)

I made a building a few weeks ago that was made up of ~2500 anchored parts.

I want to bring it down to rubble. The vision is that everything would crumble and come crashing down at once, but it would not like it was blown up by something. I have everything in place to trigger the event (it’s all handled in the server btw), but I don’t know how to approach bringing it down.

I’ve thought about learning how to use Region3 and have a region block overlap the whole building, then, when the event gets triggered, the region unanchors everything in it.

Also, to test out the physics, I unanchored everything in-game to see how the building would fall. It was disappointing. Because of how there are so many parts, Roblox doesn’t want to blow our computers up and do the math of these extra parts. not a joke they don’t wanna get sued

It looked like the building stays put until a player interacts with it. This is also disappointing because it means that I would have to learn how to apply some kind of force to force everything to collapse when unanchored. wow that was a mouthful

So, what is the best way to destroy everything? I need to handle how to unanchor the whole building the most efficient way possible and then force the physics to do the rest. (part 2 will be asking how to clean the rubble up)

This would unanchor everything I believe, as for making it look smooth… Well, you certainly won’t have it be smooth uncanchoring 2500 parts. You unfortunately will have to think of a new way.

local childs = workspace.Model:GetChildren()
for i = 1, #childs do
        wait() --optional but if not there most likely would crash device.
	local child = childs[i]
	child.Anchored = false
end

This would delete it all.

local childs = workspace.Model:GetChildren()
for i = 1, #childs do
        wait() --optional but if not there most likely would crash device.
	local child = childs[i]
	child:Destroy()
end
1 Like

Do Select all and click on the unanchor button that can be found in models I believe.

1 Like

You could un anchor all the parts and then apply BodyThrust to push them a little. That way player interaction is unnecessary.

1 Like

These would all be very good solutions until I tell everyone that the building is split up into lots of folders instead of models, so uhh, can I put all the folders into one model or is there a solution that doesn’t need models?

Thank you for all the quick replies.

1 Like

Ok. So in a script, check all the children of the model, check if the child is a folder with IsA, and use that to to then again review all the contents within that folder. Using in pairs and IsA is the best method I think for fetching children an d checking if said children are parts or folders to precede from there.

1 Like

Got it, so its just like looking through folders irl! I’ll wait overnight and see if anyone else suggests something.

Thank you! I will post the demolition soon when everything works.

I think I found a shortcut that might have saved me from painstakingly typing out all those loops.

I could just get the folder of the building and look through every descendant through GetDescendants, checking if it is a part, wedge, or truss, and then unanchoring it. I mean it could not get as simple as this?

That was kinda what I was saying, but with GetChildren().

Yes, but I’m just pointing out how I now don’t have to write extra loops to loop inside the children’s children.

I got everything to anchor now, but it still doesn’t want to fall apart unless I touch it. (and it will always freeze in place until I touch it again) I have a body thrust inserted in all the parts with a force of (1000,-1000,1000), but the physics don’t take off.

I’m wondering now if it is even possible to bring this down without a player interacting with it. I guess there is some kind of part limit that doesn’t allow me to bring this down all at once.

Use BodyForce instead sinceBodyThrust applies force to a specific point.

1 Like

that would work but you should add

if i%50 == 0 then
   wait()
end

that would be inside the loop making it so only once every 50 loops it would wait also you should probably use a for i,v in pairs() loop

I’ve changed it with no effect.

It’s definitely not anything in my script that won’t activate the physics anymore.

There is virtually no advantage to using a for i,v in pairs() loop in this scenario, specifically. The standard index loop works just fine here.

1 Like

yeah but it looks nicer than using a numerical loop

Try adding a small amount of random velocity to the parts to jitter them a bit. That should hopefully cause the parts to fall without player interaction.

local Building = game.Workspace.Building:GetDescendants()
for _,Child in ipairs(Building) do
	if Child:IsA("BasePart") then
		Child.Anchored = false
		Child.Velocity = Vector3.new(math.random(),math.random(),math.random())
	end
end

You cant really get around Roblox Physics lag however.

Edit: Sorry for the laggy video, Roblox’s Built in recorder is trash.

2 Likes

Well, after a day or two of trying to bring it down, it won’t budge. Thank you for all the replies and the suggested solutions though!

I’ve summed up my efforts in a little low-quality video…