Simple Useless Custom Shiftlock
Key RequiredUniversal

Simple Useless Custom Shiftlock

Universal ScriptAntagonistAntagonist 1.3K views 485 executesUpdated Dec 3, 2025
Unrated
00
Lua Script•127 lines (3681 chars)
-- Press Left CTRL
-- Made By Antagonist

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

-- Configuration Constants
local SHIFTLOCK_OFFSET = Vector3.new(1.75, 0, 0)
local CAMERA_DISTANCE_BUFFER = 0.5
local ROTATION_SPEED = 1

-- State Management
local shiftLockEnabled = false
local cameraConnection = nil

-- Utility: Get Character Components
local function getCharacterComponents()
    local character = player.Character
    if not character then return nil end
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local rootPart = character:FindFirstChild("HumanoidRootPart")
    
    if not humanoid or not rootPart then return nil end
    
    return {
        character = character,
        humanoid = humanoid,
        rootPart = rootPart
    }
end

-- Core: Apply Shiftlock Camera and Character Rotation
local function applyShiftLock()
    local components = getCharacterComponents()
    if not components then return end
    
    local rootPart = components.rootPart
    local humanoid = components.humanoid
    
    -- Lock mouse to center
    UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
    
    -- Get camera look direction (ignore Y axis for horizontal rotation)
    local cameraLookVector = camera.CFrame.LookVector
    local horizontalLook = Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z)
    
    -- Rotate character to face camera direction EXACTLY
    if horizontalLook.Magnitude > 0 then
        local targetCFrame = CFrame.new(rootPart.Position, rootPart.Position + horizontalLook)
        rootPart.CFrame = rootPart.CFrame:Lerp(targetCFrame, ROTATION_SPEED)
    end
    
    -- Apply shoulder offset to camera
    local offsetCFrame = CFrame.new(SHIFTLOCK_OFFSET)
    camera.CFrame = camera.CFrame * offsetCFrame
end

-- Core: Disable Shiftlock
local function disableShiftLock()
    shiftLockEnabled = false
    UserInputService.MouseBehavior = Enum.MouseBehavior.Default
    
    if cameraConnection then
        cameraConnection:Disconnect()
        cameraConnection = nil
    end
end

-- Core: Enable Shiftlock
local function enableShiftLock()
    shiftLockEnabled = true
    
    -- Connect to RenderStepped for frame-perfect updates
    if cameraConnection then
        cameraConnection:Disconnect()
    end
    
    cameraConnection = RunService.RenderStepped:Connect(function()
        if not shiftLockEnabled then return end
        applyShiftLock()
    end)
end

-- Core: Toggle Shiftlock State
local function toggleShiftLock()
    if shiftLockEnabled then
        disableShiftLock()
    else
        enableShiftLock()
    end
end

-- Input Handler: CTRL Key Detection
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    -- Accept both Left and Right Control keys
    if input.KeyCode == Enum.KeyCode.LeftControl or 
       input.KeyCode == Enum.KeyCode.RightControl then
        toggleShiftLock()
    end
end)

-- Lifecycle: Handle Character Respawn
player.CharacterAdded:Connect(function(character)
    disableShiftLock()
    
    -- Wait for character to fully load
    character:WaitForChild("HumanoidRootPart")
    character:WaitForChild("Humanoid")
end)

-- Lifecycle: Cleanup on Script Destruction
game:GetService("Players").PlayerRemoving:Connect(function(removingPlayer)
    if removingPlayer == player then
        disableShiftLock()
    end
end)

-- Initialization
print("Made By Antagonist. lol")
print("[SHIFTLOCK] Press CTRL to toggle shiftlock")

Features & Information

Lol. it's just for games that doesn't support shiftlock ig... https://youtu.be/9RKD-gWqSk0
#Antagonist#Simple#OpenSource

Community Comments (1)

AntagonistAntagonistDec 3, 2025

I was here. ig.

More Scripts for Universal Scripts