why does break like this?? i dont understand why does it break in half. Tt should only break welds in the explosion radius (and that radius is small)
weld script
function weld()
local parts,last = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Name = ("%s_Weld"):format(v.Name)
w.Part0,w.Part1 = last,v
w.C0 = last.CFrame:inverse()
w.C1 = v.CFrame:inverse()
w.Parent = last
end
last = v
table.insert(parts,v)
end
scan(v)
end
end
scan(script.Parent)
for _,v in pairs(parts) do
v.Anchored = false
end
end
weld()
script:Remove()
I think it’s about what parts are welded to. They’re all welded sequentially it looks like? You might want to change it to be by certain segments, so that parts at the front of the tank won’t be welded to parts near the back. That could be what causes it to split in half.
As @Lightlimn said, it’s the order the weldscript is attaching the Parts. It doesn’t do it sequentially, it does it by grabbing all the items in the model in a random order and welding the last part to the next one on the list. If it happens to weld all the front parts together, then all the rear parts together, with just a single weld joining the front section to the back then of course even a small explosion that breaks that single weld will break the tank in half.
There’s a tool in the Model tab in Studio called Join Surfaces. It welds Parts that you place onto each other during building, but only the Parts that touch. It would mean rebuilding the tank piece by piece.
Another option is to use the WeldConstraint in the Constraints tools in the Model tab. You can then choose which Parts you want welded to each other so you can control the way an explosion would affect the tank.