AbsoluteSize 0, 0 for a single frame

This bug is occurring in something I made around the time when guis were new. I have a LocalScript inside of a Frame that accesses the Frame’s AbsoluteSize. It incorrectly reads 0, 0 when the gui is cloned into PlayerGui.

When creating a GUI element with no parent, once its parent is set, any scripts inside of the element will run before its AbsoluteSize is calculated. This behavior is new.

4 Likes

You should attach a repro place if possible

1 Like

minimal repro (12.5 KB)

Maaaaajor necrobump, this is still an issue. The first time you read AbsoluteSize, it will return 0,0. Any subsequent reads will return the expected values.

edit: I’ve discovered more details about the nature of this problem:

  1. As mentioned, the first time accessing AbsoluteSize will return blank values. If you access a second time, it will return the correct values.
  2. However, if the GuiBase object is Visible during the first access, the correct values will be returned. Something about the object having its Visible set to false results in the AbsoluteSize value not being computed on the first index.

This behavior, if intended, is not documented on the devhub: GuiBase2d | Roblox Creator Documentation

2 Likes

I think that’s because AbsoluteSize and AbsolutePosition don’t update when Visible is false. I still think this should be fixed, but an easy workaround is to set Visible to true, then read the AbsoluteSize, and then set it back to false immediately after. I haven’t tested it, but I think that should work.

1 Like

Yes. That is precisely the workaround I used. This is still undocumented behavior.

4 Likes

As a workaround until this is fixed, perhaps you can use GuiObject:GetPropertyChangedSignal("AbsolutePosition"):Wait()?

Didn’t Roblox update the behaviour of calculated properties some time ago?