I haven’t tested this in any way, however, you could try GetDescendants() on the PlayerGUI, and those two GUIs should have different descendants so it may be possible to tell apart between the two.
To add to this (and fully answer my original question)
You can detect if a player is using the new roblox UI with this line of code
if game.GuiService.TopbarInset.Height > 45 then -- the new roblox ui uses Height == 58
If anybody is interested heres my final script for detecting and adjusting my ui button based on which roblox ui your using
local chat = script.Parent.Parent:WaitForChild("Chat")
task.wait(0.5) -- wait for TopbarInset to get its values for your player's device
if chat then
if chat:FindFirstChild("Frame") then
if chat.Frame:FindFirstChild("ImageButton") then
script.Parent.TopbarIcon.Size = chat.Frame.ImageButton.Size
if game.GuiService.TopbarInset.Height > 45 then -- the new roblox ui uses Height == 58
print("Using new roblox icon ui!")
game.GuiService:GetPropertyChangedSignal("TopbarInset"):Connect(function() -- animate when it expands
local inset = game.GuiService.TopbarInset
script.Parent.TopbarIcon.Position = UDim2.new(0, inset.Min.X+5, 0, inset.Max.Y-script.Parent.TopbarIcon.Size.Y.Offset-3)
end)
local inset = game.GuiService.TopbarInset
script.Parent.TopbarIcon.Position = UDim2.new(0, inset.Min.X+5, 0, inset.Max.Y-script.Parent.TopbarIcon.Size.Y.Offset-3)
else -- using old roblox ui
print("Using old roblox icon ui!")
script.Parent.IgnoreGuiInset = false
script.Parent.TopbarIcon.Position = UDim2.new(0,103,0,-33)
script.Parent.TopbarIcon.Size = UDim2.new(0,31,0,32)
script.Parent.TopbarIcon.IconButton.UICorner.CornerRadius = UDim.new(0.25,0)
script.Parent.TopbarIcon.IconButton.ImageTransparency = 0.5
end
end
end
end
heres some examples of my ui working with both roblox ui