Shiftlock for mobile
Key RequiredUniversal

Shiftlock for mobile

Universal Scriptbruwobruwo 1.9K views 65.2K executesUpdated Jan 27, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•102 lines (3593 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "MobileShiftlockGUI"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = Player:WaitForChild("PlayerGui")

local ToggleButton = Instance.new("ImageButton")
ToggleButton.Name = "ShiftlockButton"
ToggleButton.Parent = ScreenGui
ToggleButton.BackgroundTransparency = 1
ToggleButton.Size = UDim2.new(0, 60, 0, 60)
ToggleButton.Position = UDim2.new(0.85, -30, 0.5, -30)
ToggleButton.Image = "rbxasset://textures/ui/mouseLock_off@2x.png"

local dragging
local dragInput
local dragStart
local startPos

local function update(input)
    local delta = input.Position - dragStart
    ToggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end

ToggleButton.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = input.Position
        startPos = ToggleButton.Position
        
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end)

ToggleButton.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
        dragInput = input
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then
        update(input)
    end
end)

local Crosshair = Instance.new("ImageLabel")
Crosshair.Name = "ShiftlockCursor"
Crosshair.Parent = ScreenGui
Crosshair.BackgroundTransparency = 1
Crosshair.Position = UDim2.new(0.5, 0, 0.5, 0)
Crosshair.AnchorPoint = Vector2.new(0.5, 0.5)
Crosshair.Size = UDim2.new(0, 32, 0, 32)
Crosshair.Image = "rbxasset://textures/MouseLockedCursor.png" 
Crosshair.Visible = false

local shiftLockEnabled = false
local CameraOffset = Vector3.new(1.7, 0.5, 0)

ToggleButton.Activated:Connect(function()
    shiftLockEnabled = not shiftLockEnabled
    
    if shiftLockEnabled then
        ToggleButton.Image = "rbxasset://textures/ui/mouseLock_on@2x.png"
        Crosshair.Visible = true
        if Player.Character and Player.Character:FindFirstChild("Humanoid") then
            Player.Character.Humanoid.AutoRotate = false
        end
    else
        ToggleButton.Image = "rbxasset://textures/ui/mouseLock_off@2x.png"
        Crosshair.Visible = false
        if Player.Character and Player.Character:FindFirstChild("Humanoid") then
            Player.Character.Humanoid.AutoRotate = true
            Player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
        end
    end
end)

RunService.RenderStepped:Connect(function()
    if shiftLockEnabled then
        if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") and Player.Character:FindFirstChild("Humanoid") then
            Player.Character.Humanoid.CameraOffset = CameraOffset
            
            local rootPart = Player.Character.HumanoidRootPart
            local lookVector = Camera.CFrame.LookVector
            
            rootPart.CFrame = CFrame.new(
                rootPart.Position, 
                rootPart.Position + Vector3.new(lookVector.X, 0, lookVector.Z)
            )
        end
    end
end)

Features & Information

works even in games that don't have shiftlock pls tell me if you have any trouble using it
#shiftlock#mobile#mobile shiftlock#shift lock

Community Comments (4)

RobinsonFRobinsonFJan 27, 2026

You able to make it draggable?! Gets in the way cause of the size

Replying to @RobinsonF
bruwobruwoJan 28, 2026

@RobinsonF Just updated it!

Replying to @bruwo
RobinsonFRobinsonFJan 29, 2026

@bruwo shoot awesome!! thank you for you incredible work:)

disastergamingagjdisastergamingagjJan 31, 2026

Add like a x button to remove it

More Scripts for Universal Scripts