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

Weld script won't work on parts generated weapon. What should I do?

So, I have some parts and I put them in a tool. I try to weld the parts but it doesn't weld even if the for loop passes the right amount of times through the tool's children table. I will put a piece of code below

local function ToolMake()
	local tool = Instance.new("Tool")
	tool.Name = activatedH.Name..activatedB.Name
	
 
	local BDesc = activatedB:GetDescendants()
	local HDesc = activatedH:GetDescendants()
	for i,item in pairs(HDesc)
	do
		
		if item:IsA("Part") or item:IsA("MeshPart")or item:IsA("WedgePart") or item:IsA("UnionOperation") then
		item.Parent = tool
		item.Anchored = false
		item.CanCollide = false
	
		end
	end
	
		for i,item in pairs(BDesc)
	do
		item.Parent = tool
		if item:IsA("Part") or item:IsA("MeshPart")or item:IsA("WedgePart")or item:IsA("UnionOperation") then
		item.Parent = tool	
		item.Anchored = false
		item.CanCollide = false
	
		
		end
	end
	
	local handle = tool.Handle	
	handle.CFrame = BindingPoint.CFrame
	
	local toolTable = tool:GetChildren()
	for i , item in pairs(toolTable)
	do
		local weld = Instance.new("Weld")
		if item ~= handle then 
		weld.Part0 = handle
		weld.Part1 = item
		weld.C0 = handle.CFrame:inverse()
		weld.C1 = item.CFrame:inverse()
		end
	end
	tool.Parent = inventory
end



1 comment

0

Found it! forgot to parent the weld

1 answer

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