Screen Gui disables locked mouse

I am doing a first person shooter and have my mouse locked in center all the time.
But i want to have a gui so it all looks nice and cool.

However, when i enable a gui (enable a screen GUI in starterGUI) my program won’t see the movement of my mouse

I have looked on the internet to see if anyone had a similar problem, but it seems there isn’t

Here’s my code

local function playerInput(actionName, inputState, inputObject)
    print("moveed")
	-- Calculate camera/player rotation on input change
	if inputState == Enum.UserInputState.Change then
		cameraAngleX = cameraAngleX - inputObject.Delta.X
		-- Reduce vertical mouse/touch sensitivity and clamp vertical axis
		cameraAngleY = math.clamp(cameraAngleY-inputObject.Delta.Y*0.33, -75, 75)
		-- Rotate root part CFrame by X delta
		rootPart.CFrame = rootPart.CFrame * CFrame.Angles(0, math.rad(-inputObject.Delta.X)* 0.33, 0)
	end
end
ContextActionService:BindAction("PlayerInput", playerInput, false, Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch)

local function focusControl(actionName, inputState, inputObject)
    print("locked mouse")
	-- Lock and hide mouse icon on input began
	if inputState == Enum.UserInputState.Begin then
		UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
		UserInputService.MouseIconEnabled = false
		ContextActionService:UnbindAction("FocusControl", focusControl, false, Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch, Enum.UserInputType.Focus)
	end
end
ContextActionService:BindAction("FocusControl", focusControl, false, Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch, Enum.UserInputType.Focus)


after wiggling my mouse for a bit with screen gui enabled
https://gyazo.com/be553c5d84c134fed290fcc4cbab24d8

after wiggling my mouse for a bit without screen gui enabled
https://gyazo.com/489234ab5a7444667c7fa3da84af24dc

thank you for help

1 Like

Does the GUI have any buttons with the modal property turned on?

1 Like

no, it’s just a text label with + as text so it emulates a crosshair
https://gyazo.com/a08c06113177a20a5e929c8d5a7bbd3f

I have found the problem. The textLabel has a property Active, which i had enabled. Once it was disabled, everything was cool