How can I weld everything in a model?

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.

image
image

1 Like
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)

2 Likes
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

In studio:
image

In game:
image

Weld everything to a particular root (main) part.

4 Likes

Thank you for the script although it doesn’t do what I need.

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

Does @Forummer’s do what you need?

1 Like

I am checking right now, I actually forgot to unanchor the parts.

image
Nope it still has floating parts (even if unanchored) :weary:

1 Like

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

I know of a plugin that can weld all those models,

(4) Weld - Roblox

Just select all the parts in the model and click 'Create weld profile". It should work, if all parts are unanchored.

I tried using it, it seems to be outdated because it doesn’t do anything.

Hmmm thats weird… have you selected all the parts inside the model but not the model itself?

Try this

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

2 Likes