ScreenGui's GuiFrame's AbsoluteSizes are incorrect until the viewport gets updated (If placed in replicated storage)

If you check the absolutesize of a frame in a screengui that is parented to somewhere outside of StarterGui, it seems to spit out an invalid number (800, 600) instead of the actual viewport size.
This is troublesome because you need to find a hacky way to force an invalidate on the screengui to make sure the value become correct.

This is just an acknowledgment announcement!

We’ve filed a ticket to our internal database, and we’ll follow up when we have an update!

Thanks for the report!

Hi @aaron_mccoy - what is your use case for querying AbsoluteSize within replicated storage?

Sometimes on initialization I need to know the absolutesize/absoluteposition of guiobjects so that I can adjust certain elements. For example, I’ve got a UI system that tries to fit as many smaller UI elements as possible based on its size, and it can’t do its job if the absolutesize is incorrect.

my code structure is like so btw:

  • I have all my screengui in replicatedstorage
  • I have 1 module per screengui that has code specific to updating/initialization that gui
  • On Initializing the client, it will initialize every module, some code might be called here
  • Then it will parent every screengui to playergui and then run some different code.

I’m presuming the issue is that it’s not updating the guiobjects in replicatedstorage since its not being rendered, which is fair, however, even if I parent it to playergui, the AbsoluteSize is still wrong until the viewport size gets updated.

as seen here

Thank you for providing more information @aaron_mccoy - I would think parenting to PlayerGui would provide the correct sizing info, let me share this with the team and see what they think!

Hi, thanks for the report!

For now, we only consider the absolute size of UIs valid when they are parented into a renderable location like a ScreenGui inside PlayerGui or a SurfaceGui inside workspace. So UIs that are parented into other places like ReplicatedStorage have undefined sizes and layout results. This is similar to the behavior when an instance has no parent at all (orphan instance).

This is partially intentional - we don’t want to do unnecessary processing of UI elements in ReplicatedStorage that are inactive.

For the second issue, with the size still being incorrect immediately after parenting to the PlayerGui, I believe this is because we only update the ScreenGui.AbsoluteSize once per frame. So if a relayout is forced earlier than that (which your code does by accessing the AbsoluteSize), it will not have the correct ScreenGui size.

For getting the size of a specific frame, I suggest binding to its AbsoluteSize changed event. This way is more robust, because the screen resolution can change when the client window is resized by the player.

I’m going to close this as “By Design”.