From the looks of your code, it's set to also weld your tool's Handle as well, which may(?) cause some problems(?) I'd also recommend using a variable for the Handle, rather than re-typing the same thing over-and-over again:
local HandleVariable = script.Parent:WaitForChild('Handle')
Now, w/ that, we'll make some changes, and remove those long lines of unnecessary code:
local HandleVariable = script.Parent:WaitForChild('Handle')
for i, v in pairs(HandleVariable.Parent:GetChildren()) do
if v:IsA('BasePart') and v ~= HandleVariable then
local weld = Instance.new('Weld', v)
weld.Part0 = v
weld.Part1 = HandleVariable
weld.C0 = v.CFrame:inverse()
weld.C1 = HandleVariable.CFrame:inverse()
end
end
Now, since I haven't played ROBLOX in months, I'm going to theorize that weld's properties C0 & C1 are the problem(s); I remember a similar problems like this a while ago, and if memory doesn't fail, I multiplied the part's actual CFrame by the inversed CFrame:
weld.C0 = v.CFrame:inverse() * v.CFrame
weld.C1 = HandleVariable.CFrame:inverse() * HandleVariable.CFrame
Now, our final result is this:
local HandleVariable = script.Parent:WaitForChild('Handle')
for i, v in pairs(HandleVariable.Parent:GetChildren()) do
if v:IsA('BasePart') and v ~= HandleVariable then
local weld = Instance.new('Weld', v)
weld.Part0 = v
weld.Part1 = HandleVariable
weld.C0 = v.CFrame:inverse() * v.CFrame
weld.C1 = HandleVariable.CFrame:inverse() * HandleVariable.CFrame
end
end
Your question doesn't give a lot specifics or information, so I'm going off on a whim this time on what the problem could be; next time, could you please give more information on the problem, i.e. did you use prints? Did they all work? Was there any error feedback in the Output? If so, what did it say? And can you give us what it said? etc. :)
I hope this helped somehow, as I haven't played in months. :D
6 comments
My gut is telling me I'm wrong. >.<
you've gotten somewhere because the parts actually weld... but C0 and C1 are incorrect as you have it. C0 and C1 are incorrect as i had it too.
Ah, so that was the problem? Switching the two CFrames? :P
yes. Thankyou btw, now i can play around w/ welding. I really want to weld a ninja star that i made and script the tool.
Ok, and np man. :) Good luck on your Ninja Star! :D Haiiiii-YAAAH!!! >||
(o_o)This seems very tedious especially for multi parted tools.