Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

can you mass weld parts in Roblox Studio?

I am currently trying to make a survival game and have run into a seemingly impossible issue. I currently have hundreds of parts creating buildings that I have manually welded together. The problem is when I regenerate the map all the welds break and the game is unplayable. I want to know if there is a way to simply change the surface input of all of the surfaces on all of the bricks to welded. Can you use a for loop to call on all of the bricks and simply change the surface inputs? on the sides?

3 answers

✓ Accepted answer

Yes, but have you called :MakeJoints() on your regenerated map? That usually fixes such problems.

Roblox added a function GetDescendants to make what you ask for very simple:

for _, obj in pairs(workspace:GetDescendants) do -- or replace 'workspace' with  model/map/whatever
	if obj:IsA("BasePart") then -- can add other conditions too if desired
		-- can do whatever you like to 'obj'
	end
end

3 comments

0

I tried that, I got a test and coded

0

for i,v in pairs (#game.Workspace.Test:GetDescendants()) do if v:IsA("BasePart") then -- can add other conditions too if desired -- can do whatever you like to 'obj' v:MakeJoints() end end

0

You added a "#" in the "pairs", but you only want to do that in a 'for' loop like "for i = 1, #ch do". If all you're going to do is call :MakeJoints(), you don't need to iterate over things - just call :MakeJoints on the model you're regenerating (after you've put it in the workspace, I think)

click and drag while holding click to bax a box around the parts you want to mass select then let go and it will select all the parts in that box

1 comment

0

I need to do that with script, i need to regenerate the map and the welds every time i clone it from server storage

ok thanks, I have played with this off and on and perfected it at this point. Thank you for your answers!

This discussion is preserved as it was. New answers, comments, and votes are closed.