Record the previous CFrame and the size of the attachment. After resizing, multiply the CFrame’s position by the OldSize/NewSize. I think this should work.
@LuaCoold that won’t do any at all @SubtotalAnt8185 the part is going to be resizing in a loop, so constantly @dthecoolest how would I use that script for attachments?
Attachments actually work similarly to welds I have put an example and code in my tutorial,
So you can just replace C0 with Attachment0.CFrame and C1 with Attachment1.CFrame
for i,Accessory in pairs(Player.Character:GetChildren()) do
if Accessory:IsA("Accessory") == false then continue end
- Accessory.Handle.AccessoryWeld.C0 = --Instead of this
+ Accessory.Handle.Attachment0.CFrame = --replace it with Attachment0
Accessory.Handle.AccessoryWeld.C1 = CFrame.new((Accessory.Handle.AccessoryWeld.C1.Position * Percent)) * (Accessory.Handle.AccessoryWeld.C1 - Accessory.Handle.AccessoryWeld.C1.Position)
Accessory.Handle.Mesh.Scale *= Percent
end
How do I get the percent? The part is going to be resizing unpredictably in a loop. Also not uniformly, so it’s going to be resized in all kinds of directions.
I’ll do it for you, luckily this problem is simple enough to do on a fresh base plate.
local part = script.Parent
local attachment = part.Attachment
local initialPosition = attachment.Position
local initialSize = part.Size
while true do
local newSize = part.Size
local scaleFactorFromOriginal = (newSize)/initialSize
attachment.Position = initialPosition*scaleFactorFromOriginal
task.wait()
end