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

I want to weld all the parts in the model to the torso so why won it work?

	part = game.Workspace.Dragon:GetChildren()
	  	weld = Instance.new("Weld")
	    weld.Part0 = game.Workspace.Dragon.Torso
	    weld.Part1 = part
	    weld.C1 = part.CFrame:toObjectSpace(game.Workspace.Dragon.Torso.CFrame)
	    weld.Parent = game.Workspace.Dragon.Torso
	    part.Anchored = false 
	
	end

This should Get all the parts in the model and weld it to the torso but it wont work.

1 answer

✓ Accepted answer
for a,b in pairs(game.Workspace.Dragon:GetChildren()) do 
if b:IsA("BasePart") then
	weld = Instance.new("Weld")
	weld.Part0 = game.Workspace.Dragon.Torso
	weld.Part1 = b
	weld.C1 = b.CFrame:toObjectSpace(game.Workspace.Dragon.Torso.CFrame)
	weld.Parent = game.Workspace.Dragon.Torso
	b.Anchored = false
end
end

Possibly could be because some of 'Dragons' children are not baseparts. I am not 100% sure because you didn't give any errors from output.

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