How do I convert an Udim Offset to Scale?

Essentially, I am wanting to convert all of my UICorner CornerRaduis (Udim) to have a scale value and an offset value of 0 so it scales properly with different sized devices. I have different sized frames in my game so I would like them to all have scale values that keep the same look as having offset, example below: (currently offset)
image

If I set them all to have the same scale value, they will not have the same corner radius, example below: (currently scale)
image

In short, how can I convert an Udim offset to scale, while maintaining the same corner radius?

Divide its the UI element size’s offset field by the corresponding AbsoluteSize field

scale = offsetSize (X or Y) / absoluteSize (X or Y)

local function offsetToScale(uiElement)
    return UDim2.new(uiElement.Size.X.Scale, uiElement.Size.X.Offset / uiElement.AbsoluteSize.X, uiElement.Size.Y.Scale, uiElement.Size.Y.Offset / uiElement.AbsoluteSize.Y)
end
1 Like

I am trying to find an Udim scale, not an Udim2.

1 Like