How does AbsoluteSize actually calculate pixels?

I’m trying to do some math to position elements and taking into account instances AbsolutePosition/Size to do so. However, these properties somehow get decimals. Unsure how you can have 0.325 of a pixel? I would have thought that sizing something based on the rounded number, however that isn’t the case either.

This element says its 182.325


However, when I hop in paint.net, and count the pixels

I’m told it’s 183…
image
so does it just math.ceil the AbsoluteSize? How am I supposed to accurately size UI based on something else’s AbsoluteSize? Especially when if math.ceil can’t be used on all cases, as 184.041 is 184 pixels… what’s the cut off to round up or down on this?


image

Worth noting all documentation claims these to 2 properties are based on pixels GuiBase2d | Documentation - Roblox Creator Hub


and you can’t get a % of a pixel

If I were you, I wouldn’t worry about decimals. Whether it’s 1 pixel more or 1 pixel less, at this point, I don’t think people will notice the difference unless you’re creating a spritesheet. The interface shouldn’t appear distorted for less than one pixel, and if you’re a perfectionist, consider working with offsets and manually calculating resizing based on the player’s screen size instead. This way, having an AbsoluteSize with decimals will be impossible.

1 Like

The difference is incredibly noticeable. I want a clean sizing. Using offsets for all UI is a terrible work around

Using offset is your only solution, if you create your system accordingly it won’t be that much of a job. I do it for almost absolutely all my interfaces.

Read this answer, the second explanation may inspire you:

I wish you the best for your interface and your upcoming game!