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
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?
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.
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?
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.
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.