-- for offset calc

local A1 = cloth:FindFirstChild("A1", true)
local A1P = physicsParts:WaitForChild("A1")

local offset = A1P.Position - A1.WorldPosition
local parts = {}

local function indexParts()
	for iterator, part : BasePart in physicsParts:GetChildren() do
		parts[part.Name] = part
		if iterator%50 == 0 then
			task.wait()
		end
	end
end

local function boneUpdate()
	for _, bone in bones do
		local part = parts[bone.Name]
		bone.WorldCFrame = part.CFrame+offset
	end
end

indexParts()
RunService.RenderStepped:Connect(boneUpdate)
