Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Unlockable first person cursor?

I'm working on a "horror" game and I want the player to be able to unlock the mouse cursor by pressing LeftControl but remaining in first person as featured in "get a snack at 4am"

https://www.roblox.com/games/6165106805/get-a-snack-at-4-am

I already have my simple first person lock of course:

player = game.Players.LocalPlayer
player.CameraMode = "LockFirstPerson"

But how can I force the player to remain in first person but allow for the cursor to be moved upon pressing LeftControl?

1 answer

there's something called Modal in TextButton you can use that by making it invisible and making Modal true.

if you need the code here:

local modal = false

game:GetService("UserInputService").InputBegan:Connect(function(input, typing)
	
	if typing then return end
	
	if input.KeyCode == Enum.KeyCode.LeftControl then
		if modal == false then
			modal = true
			TextButton.Modal = true
		else
			modal = false
			TextButton.Modal = false
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.