function Basic.ScaleModelWithJoints(M,o)local I=M.PrimaryPart.Position for I,l in ipairs(M:GetDescendants())do if l:IsA("\066\097\115\101\080\097\114\116")then l.Size=l.Size*o local I=l.Position-(M:GetPrimaryPartCFrame()).p local U=l.CFrame-l.Position l.CFrame=CFrame.new((M:GetPrimaryPartCFrame()).p+I*o)*U elseif l:IsA("\083\112\101\099\105\097\108\077\101\115\104")and l.MeshType==Enum.MeshType.FileMesh then l.Scale=l.Scale*o elseif l:IsA("\074\111\105\110\116\073\110\115\116\097\110\099\101")then local M=l.C0.p*o local I,U,Y=l.C0:ToEulerAnglesXYZ()local D=l.C1.p*o local t,k,i=l.C1:ToEulerAnglesXYZ()l.C0=CFrame.new(M)*CFrame.Angles(I,U,Y)l.C1=CFrame.new(D)*CFrame.Angles(t,k,i)end end return M end function Basic.Destroy(M)if not M then return end M:Destroy()end return Basic

function Basic.ScaleModelWithJoints(model, scale)
	local origin = model.PrimaryPart.Position

	for _, obj in ipairs(model:GetDescendants()) do
		if obj:IsA("BasePart") then
			obj.Size = obj.Size*scale
			
			local distance = (obj.Position - model:GetPrimaryPartCFrame().p)
			local rotation = (obj.CFrame - obj.Position)
			obj.CFrame = (CFrame.new(model:GetPrimaryPartCFrame().p + distance*scale) * rotation)
		elseif obj:IsA("SpecialMesh") and obj.MeshType == Enum.MeshType.FileMesh then
			obj.Scale = obj.Scale*scale
		elseif obj:IsA("JointInstance") then
			local c0NewPos = obj.C0.p*scale
			local c0RotX, c0RotY, c0RotZ = obj.C0:ToEulerAnglesXYZ()

			local c1NewPos = obj.C1.p*scale
			local c1RotX, c1RotY, c1RotZ = obj.C1:ToEulerAnglesXYZ()

			obj.C0 = CFrame.new(c0NewPos)*CFrame.Angles(c0RotX, c0RotY, c0RotZ)
			obj.C1 = CFrame.new(c1NewPos)*CFrame.Angles(c1RotX, c1RotY, c1RotZ)
		end
	end
	
	return model
end

function Basic.Destroy(obj)
	if not obj then return end
	obj:Destroy()
end

return Basic
