Thanks for replying! It makes a lot more sense now. After I replied last night I took it into studio and attempted to make it work with welds.
It was fairly simple, I just followed the same code you used for resizing for offsetting the welds properly. It works like a charm.
-- // this function assumes you have it pre-welded to the body part/base part. You could make a custom welding function if you want, I assume it's not impossible.
function adjust(s, height, width, depth, prevHeight, prevWidth, prevDepth)
for i, v in pairs(s:GetChildren()) do
for u, o in pairs(v:children()) do
if o:IsA("BasePart") then
local originalSize = Vector3.new(o.Size.X / prevWidth, o.Size.Y / prevHeight, o.Size.Z / prevDepth)
o.Size = Vector3.new(originalSize.X * width, originalSize.Y * height, originalSize.Z * depth)
local d = o.Position - v.Handle.Position
local pos = o.Position + Vector3.new(d.X * (width - 1), d.Y * (height - 1), d.Z * (depth - 1))
if o.Name ~= "Handle" then -- // Makes sure it's not the handle because we are welding any other parts TO the handle.
local handle = v.Handle
-- // all this is is just reconnecting the weld to the correct body parts.
local weld
for _, w in pairs(o.Parent.Handle:children()) do
if w.Part1 == o then
weld = w
end
end
-- // same as below, offsets the weld based on the desired BodyScale while keeping it's rotations.
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = weld.C0:GetComponents()
local originalCF = CFrame.new(weld.C0.X / prevWidth, weld.C0.Y / prevHeight, weld.C0.Z / prevDepth)
weld.C0 = CFrame.new(originalCF.X * width, originalCF.Y * height, originalCF.Z * depth, r00, r01, r02, r10, r11, r12, r20, r21, r22)
weld.Part1 = o
end
end
if o.Name == "Handle" then -- // This is used for welding the Handle or the main part to whatever your welding it too
local weld = o:FindFirstChild("Handle") -- // name of the main weld.
-- // This basically grabs the already offset and C0 of the weld and offsets it slightly with set BodyScale while maintaining it's rotations.
local limb = s.Parent[v.Name] -- // this is just the thing that it is being welded to.
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = weld.C0:GetComponents() -- rotational values.
local originalCF = CFrame.new(weld.C0.X / prevWidth, weld.C0.Y / prevHeight, weld.C0.Z / prevDepth) -- original offset.
weld.C0 = CFrame.new(originalCF.X * width, originalCF.Y * height, originalCF.Z * depth, r00, r01, r02, r10, r11, r12, r20, r21, r22)
weld.Part1 = limb
end
end
end
end
I apologize for the sloopy-ish code. I’ll just leave this code here for anyone looking for a solution using welds.