About Shiftlock?

very quick question how do i disable shift lock while in first person in roblox studio so like in first person i want my mouse to be able to move around the screen and requiring right-click to rotate the avatar in roblox

Try adding a text button with modal enabled that should work

what do you mean???
whats the text button for

if you have a text button with modal enabled it will allow you to move your mouse around while in first person

so does the button act as a ‘surface’ to allow the mouse to move around while in first person?

basically, if a gui button has the modal property checked, it will unlock your mouse and let you move it around. i believe it was made so you could press a gui button while in first person.

you can make the button completely invisible but, from what I know this is a good way to allow the player to move their camera around by holding the right mouse button which, I think is what you wanted

oh thats neat, but is there an way for shiftlock to work while in that mode?

so like if the player is in 1st person, modal enabled and shiftlock on, it locks the camera but shift off, it doesnt

well if you want to relock the mouse you can disable modal

here’s a little example

local UserInputService = game:GetService("UserInputService")

local textButton = script.Parent.TextButton

UserInputService.InputBegan:Connect(function(key)
	
	if key.KeyCode == Enum.KeyCode.X then
		
		textButton.Modal = not textButton.Modal
		
	end

end)

I’m not sure what you’re trying to explain

really weird way to type

textButton.Modal = false

i think Modal bypasses shift lock, not sure

oh yeah its so you can enable and disable modal

i did this with shift instead of X and it didnt work, although the modal feature does work
the script returns the modal value as false but the mouse still moves freely

Here i made a script that does it all for you :slight_smile: (change the keycode)

local uis = game:GetService("UserInputService")

local Freemouse = Instance.new("ScreenGui")
Freemouse.Parent = game.Players.LocalPlayer.PlayerGui
Freemouse.Name = "FreeMouse"

local FreeMouseButton = Instance.new("TextButton")
FreeMouseButton.Parent = Freemouse
FreeMouseButton.Name = "FreeMouseButton"
FreeMouseButton.Position = UDim2.new({-1000, -1000},{-1000, -1000})
FreeMouseButton.BackgroundTransparency = 1
FreeMouseButton.TextTransparency = 1
FreeMouseButton.Size = UDim2.new({0, 200},{0, 50})
FreeMouseButton.Modal = true

uis.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.C then -- CHANGE C TO WHAT EVER KEY YOU WANT
		if game.Players.LocalPlayer.PlayerGui.FreeMouse.FreeMouseButton.Visible == false then
			game.Players.LocalPlayer.PlayerGui.FreeMouse.FreeMouseButton.Visible = true
		else
			game.Players.LocalPlayer.PlayerGui.FreeMouse.FreeMouseButton.Visible = false
		end
	end
end)

Modal works even if the button isn’t visible, right?

1 Like

Yes, i edited it so it shouldn’t show

it turns on modal but doesnt turn it off

shiftlock is when you press shift and it locks your mouse to centre. im also confused what u mean.

when modal is enabled, shiftlock does not work at all in 1st person regardless of shift or no shift