Moving mouse while in fp

Someone making a first person shooter and I’m making a script that will keep the player in first person the only thing is when you unlock your mouse to maybe open up the store or do something else you can’t move your mouse even though it’s unlocked how do I fix this

Can we see your code?

local inputService = game:GetService("UserInputService")
local debounce = false
game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
inputService.MouseBehavior = Enum.MouseBehavior.LockCenter
inputService.MouseIconEnabled = false

inputService.InputBegan:Connect(function (key)
	print(key.KeyCode)
	if key.KeyCode == Enum.KeyCode.LeftAlt and debounce == false then
		inputService.MouseBehavior = Enum.MouseBehavior.Default
		inputService.MouseIconEnabled = true
		debounce = false
	elseif key.KeyCode == Enum.KeyCode.LeftAlt and debounce == true then
		inputService.MouseBehavior = Enum.MouseBehavior.LockCenter
		inputService.MouseIconEnabled = false
		debounce = true
	end
end)

Have you taken a look at this?

That worked but how would I make it be able to like turn off the ability to toggle the mouse for example for a main menu where the mouse is needed

By checking before if the user can toggle the mouse before you change the camera view.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.