How to achieve a better resize

so im wondering how i would make a better resize

the first thing i show is what i have (here is the script)

wait(3)
while true do
	wait(0.15)
	for _,v in pairs(script.Parent:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Size = Vector3.new(v.Size.X - 0.1,v.Size.Y - 0.1,v.Size.Z - 0.1)
		end
	end
end

and the 2nd thing i show is what i want to achieve where it all stays together

I’m thinking you will want to make a single union that includes the larger stone and the ore pieces. Then you should look into tweening the size instead of using the loop.

If you’re set on using a loop and keeping the parts separate, your issue seems to be that you’re subtracting a fixed measurement from both the rock and the ore pieces. 0.1 is a small percentage of the size of the boulder, but a large % of the size of the ore pieces. You may be able to apply a factor (i.e. divide by a % of each measurement) instead of subtracting a fixed amount.

how would i comebine them in blender or can it be done in roblox

Unfortunately, I’m not familiar with Blender, but yes you would need to combine them there. I don’t believe you can create a union with a mesh part.

Alternatively, you could resize the multiple parts using a different method.
The scale would still be decreased linearly for each object, however you would also have to define an origin point for the scale transformation to reposition the parts. For a model, this could easily be the primary part’s position.

Then you would just reposition the part by scaling the vector between the origin and the parts position by a specific amount.
Examples:

local function scaleModel(model, scaleFactor, origin)
  origin = origin or model.PrimaryPart.Position
  for _, p in ipairs(model:GetDescendants()) do
    if p:IsA("BasePart") then
      local position = (p.Position - origin) * scaleFactor
      local size = p.Size * scaleFactor
      -- repositions the part using cframe without modifying the rotation
      p.CFrame = p.CFrame - p.CFrame.Position + position
      p.Size = size
    end
  end
end

With the function I posted, if you were to scale it in a loop, you would get an exponential decay of size which might not be desired. If that is the case, I suggest storing the relative offsets in a table and then referencing those to do a linear resizing.

wait(3)
local Primary = script.Parent.PrimaryPart
while true do
	wait(0.15)
	for _,v in pairs(script.Parent:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Size -= v.Size/10
			v.Position -= (Primary.Position - v.Position).unit/10
		end
	end
end

The position wont be accurate since i should use cframe but currently i gtg

this glitches out and deletes the primary part

this works but it’s position is off when you resize it, it goes into an entirely different spot instead of the original spot it was in