How can i offset motor6ds based on the model scale

Basically I’m trying to offset the motor6ds in the parts of the character/skin, as you can see on the image they are kinda offseted, but not enough or atleast it isn’t right.

Not scaled
image

Scaled
image

The current function used for scaling:

function scaleSkin(char, size)
	if not char or not size then return end
	
	if char:FindFirstChild("Skin") then
		local skin = char.Skin
		
		for _, part in pairs(skin:GetDescendants()) do
			if part:IsA("BasePart") then
				if not part:GetAttribute("OriginalSize") then
					part:SetAttribute("OriginalSize", part.Size) -- Set the originalsize
				end
				
				part.Size = part:GetAttribute("OriginalSize") * size -- OriginalSize scaled with size
				
				for _, child in pairs(part:GetChildren()) do
					if child:IsA("JointInstance") then
						if not child:GetAttribute("OriginalCFrame") then
							child:SetAttribute("OriginalCFrame", child.C0) -- Set the original CFrame
						end
						
						child.C0 = child:GetAttribute("OriginalCFrame") * CFrame.new(size, size, size) -- OriginalCFrame scaled with size
					end
				end
			end
		end
	end
end

Please help me get this right

Since C0 and C1 are relative to the middle of their respective parts, their offsets should scale with their respective parts as well:

--Subtract the current C0 offset and add it back scaled up with Part0
child.C0 = (child.C0 - child.C0.Position) + childPart0ScaleFactor * child.C0.Position
1 Like

Thank you so much, been looking for the answer for a week now!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.