I've been able to change whether or not the setting is locked, but not if it's on or off. I'm also interested in doing this at any time during the game, so setting a preset is not going to cut it (yes, I know about the StarterPlayer setting). Here's how I lock the setting:
switch_shift_lock.OnServerEvent:Connect(function(player)
player.DevEnableMouseLock = not player.DevEnableMouseLock
end)
The reason it's server side is because, when I did it on the client, it said "permission denied." Or something to that effect. Anyway, I can't find a single thing to help me out. Any assistance would be greatly appreciated, Aether.
If found a way that should work to disable shift lock, but it doesn't. All it does is remove the icon for shift lock (there are no errors):
local player_scripts = player.PlayerScripts
local player_module = player_scripts.PlayerModule
local camera_module = player_module.CameraModule
local mouse_lock_controller = require(camera_module.MouseLockController)
local function disable_mouse_lock()
mouse_lock_controller:EnableMouseLock(false)
end
-- and yes, the function is being called

3 comments
You'd think that Roblox would make this intuitive and easy, but nooooo...
Read this https://developer.roblox.com/en-us/api-reference/property/Player/DevEnableMouseLock
Did you read the question, or...?