The object’s scale property is based on the parent’s AbsoluteSize/AbsolutePosition. All you need to do is multiply the scale value by the AbsolutePosition of the parent.
Edit:
I misread the post… offset = UDim2.new(0, image.Parent.AbsolutePosition.X*image.Position.X.Scale+image.Position.X.Offset, 0, image.Parent.AbsolutePosition.Y*image.Position.Y.Scale+image.Position.Y.Offset)
I found a better method by accident going to post it here because it’s more efficient as you don’t need to do the math to get the offset from scale, and this works with constraints such as UIAspectRatioConstraint
you take the absolute size directly from the GuiObject you want to convert into offset from scale as shown below
there is no need to do the math if you do it this way
Example:
function Resize_Offset()
local AB_Size = LogoBase.Parent.AbsoluteSize
local LB_Size = LogoBase.AbsoluteSize
--Logo.Size = UDim2.new(0, AB_Size.X * LB_Size.X, 0, AB_Size.Y * LB_Size.Y) -- Previous Method which uses math then sets the UDim2
Logo.Size = UDim2.new(0, LB_Size.X, 0, LB_Size.Y) -- newer method which just reads a value and then sets the UDim2
print(LB_Size)
end
Adding onto this, I use this method when I display images in an inventory/shop. I would divide the AbsoluteSize.X by a certain number, and assign the offset on X and Y to that offset.
Keep in mind that this method will break if you’re using a folder, and it may be a better idea to use image:FindFirstAncestorWhichIsA("GuiBase2d") than image.Parent.
Edit: Replied to the wrong post, meant to reply to @Hexcede.