Mouse unlocks when opening Backpack

A simple script that allows your Cursor to move freely around your screen while your Inventory is open to allow easier usage of the backpack!
Expecially useful for First-Person-Locked Experiences in which the Backpack is fundimental for gameplay (or optional).

:envelope_with_arrow: Download the .RBXM file here: InventoryUnlocksMouse.rbxm (5.9 KB)
:envelope_with_arrow: Or get it from the Creator Marketplace: create.roblox.com/store/asset/106443383261327

This is done by using a ScreenGui with a TextButton (size set to 0 so you can’t actually see it) with the Modal property True, when the player opens or closes their inventory, the TextButton is set to visible, or not.

:white_check_mark: Accounts for:
-Using the [ \ ] Keybind (Opening/Closing)
-Opening the Main Menu
-Clicking out of the Backpack GUI (Closing, checks for GameProcessedEvent)
-Backpack CoreGui is set to false (Closing)

:cross_mark: Does NOT account for:
-Using the Topbar Backpack button (Mostly closing)

Please let me know if you find any issues or find a way to detect when the player clicks the Topbar Backpack Button image (this one). Thanks!