I am trying to weld a multi-part sword together, but every Weld script I have found does not work with my sword, but it does with other tools (the one they came with).
Any help?
Weld Script 1
local previous
local part = script.Parent:GetChildren()
for i = 1, #part do
if part[i].ClassName == "UnionOperation" or part[i].ClassName == "Part" then
if not previous == nil then
local weld = Instance.new("Weld")
weld.Part0 = previous
weld.Part1 = part[i]
weld.C0 = previous.CFrame:inverse()
weld.C1 = part[i].CFrame:inverse()
weld.Parent = previous
part[i].Anchored = false
end
previous = part[i]
end
end
wait(3)
Weld Script 2
function Weld(a, b)
local w = Instance.new("Weld")
w.Part0 = a
w.Part1 = b
local CJ = CFrame.new(a.Position)
local C0 = a.CFrame:inverse() * CJ
local C1 = b.CFrame:inverse() * CJ
w.C0 = C0
w.C1 = C1
w.Parent = a
end
function Get(A)
if A.className == "Part" then
Weld(script.Parent.Handle, A)
A.Anchored = false
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end
function Finale()
Get(script.Parent)
end
script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()
I know they are quite large, but I have not found any errors in them. Any help is appreciated.
TheArmoredReaper
EDIT : I am trying to link this to a for loop, allowing the script to weld as many parts as needed. Every part inside my model is a Union, thus its class name is UnionOperation.

1 comment
http://wiki.roblox.com/index.php?title=Weld