Disabling shift lock spontaneously for a player without locking their mouse

I’m working on a theme park Queue System, and when a player enters the automated cue I set their CameraMinZoomDistance to 5 and turn off their Shift Lock so that they can’t spin around and are forced to face the right direction. (I can’t just disable auto-rotate because they need to be able to turn around barriers)

The issue I’m facing is that if they have shift lock enabled when they walk into the cue, the script turns it off and the icon disappears yet the controls just act like the player is in first person

Here is a video of what happens:

https://gyazo.com/b12b70fb4b653e69ed46e83e14edaf34

This is the code I am using to disable the player's shift lock.
QueueEvent.OnServerEvent:Connect(function(Player,Event,Ride) 
	if Ride == RIDE_NAME then
		if Event == "LeaveQueue" then
			local OccupiedSpot = FindPointWithOccupant(Player.Name)
			if OccupiedSpot then
				OccupiedSpot.Occupant.Value = ""
				OccupiedSpot.Occupied.Value = false
				ToPoint(Player,Exit)
				Player.DevEnableMouseLock = true -- This is where shiftlock is disabled
				Player.CameraMinZoomDistance = 0
			end
		end
	end
end)

Any help is appreciated!

1 Like

In this post someone is trying to achieve the same effect that you are trying to replicate. Take a look at the solution and hopefully it helps!

Maybe this will help: Disabling Shift Lock.

To lock/unlock the camera by using the following code:

local UIS = game:GetService("UserInputService")
-- lock the mouse
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter 
-- unlock the mouse
UIS.MouseBehavior = Enum.MouseBehavior.Default