GuiService:GetGuiInset for ScreenInsets?

Good morning all,

I seem to be having an issue with one of the GUIs I’m making. If I set ScreenInsets to none, the GUI will fill up the entire area of the screen like I want it to. However, I’m using the AbsoluteSize/AbsolutePosition of other GUIs to get the gui to be relative to other GUIs on the screen.

The problem I’m running into is that AbsoluteSize/AbsolutePosition assume ScreenInsets of CoreUISafeInsets. Similarly, GuiService:GetGuiInset(), returns the insets for a inset of type Enum.ScreenInsets.TopbarSafeInsets, whereas what I need is the Inset for the type Enum.ScreenInsets.None

Any idea how to get the true Enum.ScreenInsets.None GuiInset?

Thank you,
blowup999

1 Like

If anyone else needs a quick fix for this, this seems to work across all devices as far as I can tell (although it only returns the TopLeft Inset). Let me know if someone knows of an actual roblox function so I don’t have to use this janker.

local function getInset()
	local sg = Instance.new("ScreenGui", Player.PlayerGui)
	sg.Enabled = false
	
	local frame = Instance.new("Frame", sg)
	
	local sg2 = sg:Clone()
	
	sg.SafeAreaCompatibility = Enum.SafeAreaCompatibility.FullscreenExtension
	sg.ScreenInsets = Enum.ScreenInsets.None
	
	local vect = sg2.AbsolutePosition - sg.AbsolutePosition
	sg:Destroy()
	sg2:Destroy()
	
	return UDim2.new(0, vect.X, 0, vect.Y)
end
2 Likes