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

My weld script is not working the output is saying Part2 is not a valid member of weld?

script.Parent.Anchored = false
w = script.Parent.Parent
weld = Instance.new("Weld")
weld.Part0 = w.One
weld.C0 = w.One.CFrame:inverse()

weld.Part1 = script.Parent
weld.C1 = script.Parent.CFrame:inverse()

weld.Part2 = w.Two
weld.C2 = w.Two.CFrame:inverse()

weld.Part3 = w.Three
weld.C3 = w.Three.CFrame:inverse()

weld.Part4 = w.Four
weld.C4 = w.Four.CFrame:inverse()


weld.Parent = script.Parent

script.Parent.Anchored = false


I watch PeasFactory's tutorial and this is not working Please Help I'm trying to weld a tool that has mesh's Help?

1 answer

If you just need a simple weld scripts that welds everything inside a model together, Use this:

local prev 
local parts = script.Parent:GetChildren() 
for i = 1,#parts do 
	if (parts[i]:IsA("BasePart") or parts[i].className == "UnionOperation") then 
		if (prev ~= nil)then 			
			local weld = Instance.new("Weld") 
			weld.Part0 = prev 
			weld.Part1 = parts[i] 
			weld.C0 = prev.CFrame:inverse() 
			weld.C1 = parts[i].CFrame:inverse() 
			weld.Parent = prev 
		end 
		
		prev = parts[i] 
	end 
end 

parts = script.Parent:GetChildren() 
for i=1,#parts do
	if (parts[i]:IsA("BasePart") or parts[i].className == "UnionOperation") then
		parts[i].Anchored = false
	end
end

script:remove()

3 comments

0

Make sure the tool is completely anchored

0

Bbut they have meshes I cant union

0

You dont have to union

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