Hi guys. I’m writing a code so that I can move the mouse when I open the roblox backpack. I need to know this because my game works in first person. So I need to know when the backpack gui appears, so I can switch to classic camera mode and set the cameraType to scripted and let it follow my character’s head. Then I’ll be able to move the mouse and continue in “first person”.
But I had a small problem with this, at first I tried to use contextactionservice, and put the key that opens the backpack, but depending on the country the position of the keys changes. After that I tried to find out if I could manually see if the gui was visible or not, but I didn’t find anything about it.
I couldn’t find an event-based way to check but you can poll the existence of a context action that the backpack script binds only when it’s open.
local ContextActionService = game:GetService("ContextActionService")
local openBackpackActionName = "RBXRemoveSlot"
local function isBackpackOpen()
local info = ContextActionService:GetBoundActionInfo(openBackpackActionName)
return next(info) ~= nil
end