A way to autodetect roblox topbar version

Greetings developers, Recently I came across an issue that really bothers me because it’s just bad visually.

I wonder is there a way to auto detect the roblox topbar version so I don’t have to manually update the game to fix the topbar offset.

image
image

These two randomly occurred and its getting frustrating because today I updated the game and the topbar was old so i changed it back and when that update was released roblox reverted it to the new one and its getting on my nerves.

Edit:
For those who want the code to the solution I used.
Pretty sure this only works in a client script but not certain

local function checkTopbarVersion()
	local inset:Vector2,inset2:Vector2 = guiService:GetGuiInset()
	if inset.Y == 58 then
		script:SetAttribute("NewVersion",true) --I used an attribute to get the version in other parts
	else
		script:SetAttribute("NewVersion",nil) --both nil and false would work, this returns the old version
	end
end
1 Like

Maybe try using the Version property from CoreGui.

image
Not sure that will work because of the permission level

GuiService:GetGuiInset() will return different Vector2 values based on which version of the topbar is in-use. The new CoreGui is 58 pixels tall; can’t remember off the top of my head what the old one is. Bear in mind that console does not have a topbar, so it’s inset will be 0.

To that effect, though, you can read from GuiService.TopbarInset to dynamically reposition your elements, which you’ll need to do with the new CoreGui anyway since its size is not static; however, I’ve found this property isn’t always set immediately, so if you need to know which CoreGui is being used to decide the visual style for your UI, use the previous method rather than this.

1 Like

The GetGuiInset() method worked perfectly for me, thank you.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.