A way to weld everything without manually doing it

This post is probably meaningless to me but is there anyway I can make parts in a group all be welded together since their connected?

I really don’t feel like manually welding everything together, and I cant make it a group because I am using script with getchildren command to move all of these parts, but I can only do that if it is all welded together.

3 Likes

You can put all the Parts you want welded into a model and add this script to the model:
https://www.roblox.com/library/541115218/WELDOMATIC
I took a free model weld script and fine tuned it a bit. Basically you can have all the Parts Anchored as well to make them easy to align and place, then this’ll weld them then unanchor them.

2 Likes

you could run a similar code in the command bar

   local model = workspace.Model:GetChildren() -- or wherever the model is

   for i = 1, #model do 
              local weld = Instance.new("Weld")
              weld.Part0 = model[i]
              weld.Part1 = model[i+1] -- to overcome an issue where model[i+1] = nil, we could pass the (second) EndValue  of the numeric for loop as #Model:GetChildren() -1, but not an issue when running it through the command bar
              weld.Parent = model[i]
   end

a numeric loop to create a weld between all items sequentially in a model.

it is cleaner to use a generic loop as said below (but here a numeric loop is being used in the command bar just to get the job done)

7 Likes

You don’t really need to use a numeric loop if you’re going through a table. It’s much cleaner to use a generic for loop here, like so:

local previous = nil

for i, current in ipairs(model) do
	if not previous then continue end

	local weld = Instance.new("Weld")
	weld.Part0 = current
	weld.Part1 = previous
	weld.Parent = current
end

(This solution also cleans up the problem with the bad weld at the end of loop.)

5 Likes