Issue with FirstPersonLock UI

Hello! My name is Light and this week I was attempting my first GUI, I was able to get my GUI to work perfectly fine until I set my game to FirstPersonLock and realised that the GUI had an issue when it is closed you can’t look around at all. I did make sure to set modal active on an ImageButton.

this can be tested here: roblox.com/games/6294110095/Feature-Testing
(Press ‘Tab’ to open GUI)

If it matters, here is the script I made to open the UI

local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")

UIS.MouseIconEnabled = false

UIS.InputBegan:Connect(function(input, gameProcessed)
	if input.KeyCode == Enum.KeyCode.Tab then
		if Players.LocalPlayer.PlayerGui.ScreenGui.Inventory.Visible == false then
			Players.LocalPlayer.PlayerGui.ScreenGui.Inventory.Visible = true
			UIS.MouseIconEnabled = true
		else Players.LocalPlayer.PlayerGui.ScreenGui.Inventory.Visible = false
			UIS.MouseIconEnabled = false
		end
	end
end)

Any help is appreciated, thank you!

Could you explain the issue you have in more detail? When I played the game it seemed like you could look around fine - both with the GUI on and off.

I have tried on 2 different PC’s and I am only able to look around while holding right click. been a month and I still don’t understand.

I don’t think the issue has anything to do with the script you provided then. Could you post the script that handles the first person lock?

I don’t have a script setting it to FPL, I set it through properties and that is the only script in the place

Try using this instead of setting it via properties:

local player = game.Players.LocalPlayer
 
player.CameraMode = Enum.CameraMode.LockFirstPerson

that did not fix the issue, at this point i’ll pay you if you come into studio and fix it.

Just post your file and I’ll take a look.

brokengui.rbxl (32.1 KB)

Hahahaha. This has to be some kind of sick joke. I spent about 45 minutes trying to figure out why it wasn’t working only to find out that GUIbuttons have a property called modal which means you can’t move the mouse unless you have the right mouse button down. The property is only active if the GUIbutton is visible, which in your case it was - it’s just you made the frame behind it invisible. You’ll probably have to set all of the buttons to invisible or else make it so that you can move the mouse freely when you enter the inventory tab.

1 Like

okay I will do that, modal is required for GUIS tho am I correct?

Modal is useful for allowing mouse movement when GUIs are open. Either way, it’s the reason you haven’t been able to look around properly.

I am planning on making this an inventory Gui so I would need to have the modal on, thanks for all the help this really engaged my thinking skills