How do I force-disable shiftlock

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to force disable shiftlock but only for a specified amount of time.

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that I think it’s only disabling the shiftlock switch and not forcing a player out of shiftlock.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried looking for solutions but they are all either not related to disabling shiftlock or they haven’t had any solution, some just told the person to disable shiftlock completely from StarterPlayer, but this isn’t what I want since I don’t want to disable shiftlock permanently.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

This is the part of my script that I’m trying to fix (It’s in StarterCharacterScripts)

player.CharacterAdded:Connect(function(char)
	local controlmodule = require(player.PlayerScripts:WaitForChild("PlayerModule"))
	local camera_module = controlmodule.CameraModule
	local shiftlock = require(camera_module.MouseLockController)
	local Controls = controlmodule:GetControls()
	ForceDisableShiftlock.OnClientEvent:Connect(function(duration)
		Controls:Disable()
		shiftlock:FindFirstChild("BoundKeys").Value = ""
		task.wait(duration)
		Controls:Enable()
		shiftlock:FindFirstChild("BoundKeys").Value = "LeftShift, RightShift"
	end)
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Im not entirely sure but you can probably use this piece of code as a reference. Instead of removing the binds for shiftlock, why not disable it for a bit?

game:GetService('StarterPlayer').EnableMouseLockOption = false
1 Like

didn’t work but thanks for trying to help

1 Like

In StarterPlayer there should be a property to disable or enable shiftlock just like the guy above us said

2 Likes

yes but I don’t want to disable it permanently, disabling it through StarterPlayer will disable it for all players permanently. I want to disable it for one player and only for a short period of time, but force them out of it instead of just turning off the ability to switch.

1 Like

If i remember correctly theres a property on the Player object that does exactly that its called DevEnableMouseLock

2 Likes

oh okay thanks, I will look for more information about it

If that doesnt work you could also try this using MouseBehavior

local UIS = game:GetService("UserInputService")
task.wait(4)
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter --To enable it
task.wait(4)
UIS.MouseBehavior = Enum.MouseBehavior.Default --To do the exact opposite

Try testing this to see if this works!

2 Likes

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