Make GetGuiInset more usable

GuiService:GetGuiInset() returns the inset of user GUIs (i.e. of the topbar). However, GetGuiInset returns 0,0 until the topbar loads. I agree with this behavior, but there’s no way for me to tell whether or not GetGuiInset is returning 0,0 because the inset is actually 0,0 or because the topbar hasn’t loaded yet. I’d like to be able to do something like:

if not GuiService.IsTopbarLoaded then
    GuiService:GetPropertyChangedSignal("IsTopbarLoaded"):wait()
end

local insetAfterLoad = GuiService:GetGuiInset()

and for when inset changes more than on topbar load:

while GuiService:GetPropertyChangedSignal("GuiInset"):wait() do
    print("Inset changed to", GuiService.GuiInset)
end


Right now I’m having to resort to hacks like:

while not game:FindFirstChild("TopBarContainer", true) do
   wait() 
end

local insetAfterLoad = GuiService:GetGuiInset()
6 Likes

Thanks for reminding me.

http://devforum.roblox.com/t/changes-to-topbarenabled/29806/18

@TheGamer101 Time to start fixing this.

3 Likes

Yeh, I’m with you on this one.

I absolutely hate that the following code doesn’t work:

local x, y = button.MouseButton1Down:wait();
local relative = Vector2.new(x, y) - button.AbsolutePosition;
--lol no relative is wrong