Perhaps when you set the size of the part, iterate over all attachments inside the part, and you get the ratio of the new size and the old size. You then multiply that by the current attachment position to scale the attachment to the ratio the part was scaled down. Then set the position to that.
So, something like this:
local part = script.Parent
local attachment = part.Attachment
local currentSize = part.Size
local newSize = Vector3.new(25, 17, 20)
local ratio = newSize / currentSize
part.Size = newSize
attachment.Position = attachment.Position * ratio
Here is a demo place you can check out: Attachment.rbxl (18.4 KB)