I was wondering why my mouse was still unlocked even though I was in first-person and no GuiButtons were on screen. Turns out if you have an enabled ScreenGui with a ScrollingFrame as a child whose Visible value is false and have any button as a child of that with its Modal value set to true, your mouse will remain unlocked.
My Hierarchy:
The ScreenGui is enabled
ScrollingFrame Visible is false
ImageButton Modal is true
The result: My mouse is unlocked even though I’m in first-person.
This behavior stops and everything works as expected if you replace the ScrollingFrame with just a regular Frame that is invisible.
This bug leads to invisible menus unlocking my mouse which is rather annoying.