Making a weld script and I ran into the issue of rotating the pieces properly to go on the model
--Declare Table
local parts = {}
--Grab Parts
local handle = script.Parent.Handle
local children = script.Parent:GetChildren()
for idx,child in ipairs(children) do
if(child.ClassName == "Part")then
table.insert(parts,child)
end
end
--Store Current Part Positions
local partsLocations = {}
for key,value in pairs(parts) do
local pos = value.Position
table.insert(partsLocations,key, pos)
end
--Store Current Part Rotations
local partsRotates = {}
for key,value in pairs(parts) do
local rotate = value.CFrame - value.Position
table.insert(partsRotates,key,rotate)
print(tostring(rotate) .. " - " .. tostring(value))
end
--Subtract Positions from Handle Postion to Make them relative for use in CFrame
local cFrameLocations = {}
local handlePos = Vector3.new(0,0,0)
for key,value in pairs(partsLocations)do
for idx,part in pairs(parts) do
if(idx == key and tostring(parts[key]) == "Handle") then
handlePos = Vector3.new(value.x + handlePos.x,value.y + handlePos.y,value.z + handlePos.z)
end
end
if(parts[key] ~= "Handle") then
local finalPos = Vector3.new(value.x - handlePos.x,value.y - handlePos.y,value.z - handlePos.z)
table.insert(cFrameLocations,key,finalPos)
end
end
-- Make Welds and Map Each Part To The New Location/Rotation
if parts ~= nil then
for key,value in pairs(parts) do
if(tostring(value) ~= "Handle") then
key = Instance.new("ManualWeld",handle)
key.Part0 = handle
key.Part1 = value
value.Anchored = false
for posKey,posValue in pairs(cFrameLocations) do
if(parts[posKey] ~= "Handle") then
if(parts[posKey] == value)then
for rotKey,rotValue in pairs(partsRotates) do
if(parts[rotKey] == value) then
key.C1 = CFrame.new(0 - posValue.x,0 - posValue.y,0 - posValue.z,rotValue.R01,rotValue.R02,rotValue.R10,rotValue.R11,rotValue.R12,rotValue.R20,rotValue.R21,rotValue.R22)
end
end
end
end
end
elseif(tostring(value) == "Handle") then
value.Anchored = false
end
end
else
print("failure")
end
This is the entire script; I attempted to store just the rotational matrix of the CFrame, and call out the difference pieces of it as they were need
But you either cant; or I dont know how to; call on said inidividual pieces My attempt is on Line 59(The site didnt like how long the line was; so it cut some of it off; it wasnt conceptually relevant regardless)
Can someone help me out?

2 comments
For this, I would recommend this tutorial: http://wiki.roblox.com/index.php?title=Weld
I see what you mean; my bad thank you