How do I make a custom shift lock system[HELP NO LONGER NEEDED]

Hi, I wanna make a custom shift lock system, and I’ve tried many ways but I’m so confused to do it, can you all help me?
Help is appreciated.

I’m not too sure what you mean by “custom” but in the Roblox settings players can choose to turn it on, how ever if you wish to force shift lock so it’s always on try the tutorial I’ve linked below.

Edit: there really is no way to make a “custom” Shift Lock due to the fact its a function rather than a cosmetic feature.

1 Like

I Think he wants to create a different shift lock system. A custom one. that is different from roblox shift lock.

You should see the following articles for more information:

This way you can monitor when players have pressed shift, and you can control the camera accordingly!

Hope this helps,
-Tom :slight_smile:

I have made it work, but it only works with when camera moves, and for moving the camera you need to press right click, and I don’t want that. Here’s the code:

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local RunService = game:GetService("RunService")

local Camera = game.Workspace.CurrentCamera

	local pitch, yaw, roll = Camera.CFrame:ToEulerAnglesYXZ()
	Character.HumanoidRootPart.CFrame = * CFrame.Angles(0, yaw, 0)

UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local pitch, yaw, roll = Camera.CFrame:ToEulerAnglesYXZ()
Character.HumanoidRootPart.CFrame = * CFrame.Angles(0, yaw, 0)

this will make it follow the mouse, however the player doesn’t rotate as smoothly as with shift lock

1 Like

I have created one at the moment. I will share the script, if you have any questions, feel free to ask.

local character = (game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait());
local userInputService = (game:GetService("UserInputService"));
local runService = (game:GetService("RunService"));
local camera = (workspace.CurrentCamera);
local isShiftLockToggled = (false);

function input_Began(input, gpe)
	if (gpe) then return end;
	if (input.KeyCode == Enum.KeyCode.LeftShift) then
		isShiftLockToggled = not isShiftLockToggled
		print(string.format("Shift lock state: %s", isShiftLockToggled and "Yes" or "No"))


function render_Step(dt)
	userInputService.MouseIconEnabled = not isShiftLockToggled
	userInputService.MouseBehavior = isShiftLockToggled and Enum.MouseBehavior.LockCenter or Enum.MouseBehavior.Default
	local humanoid = (character:FindFirstChildOfClass("Humanoid"));
	local humanoidRootPart = (character:FindFirstChild("HumanoidRootPart"));
	if (humanoid) and (humanoidRootPart) then 
		humanoid.AutoRotate = not isShiftLockToggled
		humanoid.CameraOffset = isShiftLockToggled and humanoid.CameraOffset:Lerp(, dt * 1.5) or humanoid.CameraOffset:Lerp(, dt * 1.5)
	if (isShiftLockToggled) then
		local x, y, z = camera.CFrame:ToOrientation();
		humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp( * CFrame.Angles(0, y, 0), dt * 5)


I recommend looking at this post. Although I recommend trying to make it yourself for experience.

This small script locks the player’s mouse & forces them to face the same direction as their camera, mimicking a shift lock.

I’m using a couple of deprecated features but, I’m sure you can just understand the basis of it.

local UIS = game:GetService("UserInputService");
local Player = game.Players.LocalPlayer;
local Cam = workspace.CurrentCamera;
local Mouse = Player:GetMouse();
local RunService = game:GetService("RunService");
local IsLocked = false;

	if IsLocked then
		UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
		UserSettings():GetService("UserGameSettings").RotationType = Enum.RotationType.CameraRelative

UIS.InputBegan:Connect(function(input, gpe)
	if input.KeyCode == Enum.KeyCode.LeftShift and not gpe then
		IsLocked = not IsLocked