I’ve searched every corner of the internet on but have only came across tutorials on how to make A destructible building, not hundreds if not thousands in my city map. I’ve tried many methods but most of them are successful in creating the welds, but the connecting parts dont get their joints broken leading to a floating skyscraper
I didn’t make my city map so their are a lot of unorganized parts lying around so I can’t really group them into a model where i could break all of the children of the model’s joins easily.
all of the vids i see on voxbreaker show the objects in a stud-like style (meaning it looks like each building was custom made, not just a part with a decal like my buildings. It says it supports MeshParts so could i possibly use regular parts, which is what my buildings are composed of)
also could you go further into detail on how you would make it on the fly?
There are a bunch of ways you could go about it. Obviously, welds is one approach but you can always make it welded to a bottom part that is anchored. That way, if the anchored part is destroyed, it is destroyed.
local partA = workspace.PartA
local partB = workspace.PartB
local weld = Instance.new("WeldConstraint")
weld.Part0 = partA
weld.Part1 = partB
When you’re ready for the building to become, you’d remove these welds by something like BasePart:BreakJoints(), This removes any attached welds, weld constraints, and other joints on that part.
If that doesn’t work for your needs, what about running a check for what region it’s in using a center point? That way, you can also make sure it only has those effects when players are within a certain range. I don’t have a lot of experience doing that with Region3 but here’s an example.
-- We can set up where the skyscraper is with a center location and by setting a point where the region extends from
local center = Vector3.new(0,100,0) -- adjust based on your skyscraper
local halfSize = Vector3.new(50, 100, 50) -- half the dimensions of the region
-- We set the coordinates with the center and halfSize locations
local region = Region3.new(center - halfSize, center + halfSize)
local partsInRegion = workspace:FindPartsInRegion3(region, ignoreList, math.huge)
That code isn’t perfect but it’s an option. Let me know if you need clarification
Thanks for the help, but my main issue was figuring out which is a skyscraper or building. For example, my skyscrapers are 3+ stories tall so I would need to get all parts above it which I don’t know how I would do. (Especially when NONE of the parts are grouped together and each story of a building is just named part, and there are 100s of buildings)
will this allow me to for example get all parts in a certain radius depending on a part? So for example 10 studs above a part or 10 to the left or etc.?