I’m trying to weld every part in a model to each other. I want to make all the parts weld to each other. Although the free model qperfectionweld scripts don’t work at all. I am looking for suggestions/scripts. I want the parts to be able to fall if the part it was welded to was deleted. Basically like the old games.
In simpler words I was wondering if anyone knows of a weld script specifically for maps?
Suggestions/links will be appreciated.
For example the image below has a floating block after the parts that were holding it up were deleted. I am trying to make it so after whatever was holding it up was deleted it falls but remains welded.
local function WeldModel(model)
for _,v in pairs(model) do
for _,z in pairs(model) do
if z ~= v then
local weld = Insatance.new("WeldConstraint")
weld.Parent = v
weld.Part0 = v
weld.Part1 = z
end
end
end
end
Lag may occur depending on the model detail (parts)
local model = script.Parent
local main = model.Main
for _, child in ipairs(model:GetChildren()) do
if child:IsA("BasePart") then
if child ~= main then
local weld = Instance.new("WeldConstraint")
weld.Part0 = main
weld.Part1 = child
weld.Parent = child
end
end
end
Your script works amazingly (TY) but I am trying to make the parts fall. For example this tree is floating after the contents that were below it were deleted. I am trying to make it so they can fall.
The parts will only fall if those welds are destroyed. When you destroy a single part’s weld to the root it’ll fall (providing it isn’t suspended in the air by other parts).
function weld(model)
local LastPart
for i,v in pairs(model:GetDescendants()) do
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") then
if LastPart then
local weld = Instance.new("WeldConstraint")
weld.Parent = v
weld.Part0 = LastPart
weld.Part1 = v
LastPart = v
else
LastPart = v
end
end
end