ShiftLock Mobile/PC

Pasted Oct 22, 2026, 5:02 PM1 file173 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgspe88fxew0bz7
ShiftLock
-- SHIFT LOCK MOBILE/PC
-- LocalScript dentro do ImageButton

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

local player = Players.LocalPlayer
local button = script.Parent

local shiftLock = false
local connection

-- CONFIGURAÇÕES
local CROSSHAIR_SIZE = 5 -- pode mudar para 3, 4 ou 5
local IMAGE_ID = "rbxassetid://116526467772325"

--------------------------------------------------
-- CRIA A MIRA NO CENTRO DA TELA
--------------------------------------------------

local playerGui = player:WaitForChild("PlayerGui")

local crosshairGui = Instance.new("ScreenGui")
crosshairGui.Name = "CustomShiftLock"
crosshairGui.ResetOnSpawn = false
crosshairGui.IgnoreGuiInset = true
crosshairGui.Enabled = false
crosshairGui.Parent = playerGui

local crosshair = Instance.new("ImageLabel")
crosshair.Name = "Crosshair"
crosshair.BackgroundTransparency = 1
crosshair.AnchorPoint = Vector2.new(0.5, 0.5)
crosshair.Position = UDim2.fromScale(0.5, 0.5)

-- Tamanho 3 ou 5
crosshair.Size = UDim2.fromScale(
CROSSHAIR_SIZE / 100,
CROSSHAIR_SIZE / 100
)

crosshair.Image = IMAGE_ID
crosshair.ScaleType = Enum.ScaleType.Fit
crosshair.Visible = true
crosshair.Parent = crosshairGui

--------------------------------------------------
-- FUNÇÃO SHIFT LOCK
--------------------------------------------------

local function ativarShiftLock()
    
    shiftLock = true
    crosshairGui.Enabled = true
    
    local character = player.Character
    if not character then return end
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local root = character:FindFirstChild("HumanoidRootPart")
    
    if not humanoid or not root then return end
    
    -- Impede o personagem de girar sozinho
    humanoid.AutoRotate = false
    
    -- Mantém a câmera acompanhando o personagem
    connection = RunService.RenderStepped:Connect(function()
        
        if not shiftLock then
            return
        end
        
        character = player.Character
        
        if not character then
            return
        end
        
        humanoid = character:FindFirstChildOfClass("Humanoid")
        root = character:FindFirstChild("HumanoidRootPart")
        
        if not humanoid or not root then
            return
        end
        
        local camera = workspace.CurrentCamera
        
        if not camera then
            return
        end
        
        -- Personagem olha para a direção horizontal da câmera
        local lookVector = camera.CFrame.LookVector
        local direction = Vector3.new(
        lookVector.X,
        0,
        lookVector.Z
        )
        
        if direction.Magnitude > 0.01 then
            root.CFrame = CFrame.lookAt(
            root.Position,
            root.Position + direction
            )
        end
        
    end)
end

--------------------------------------------------
-- DESATIVAR SHIFT LOCK
--------------------------------------------------

local function desativarShiftLock()
    
    shiftLock = false
    crosshairGui.Enabled = false
    
    if connection then
        connection:Disconnect()
        connection = nil
    end
    
    local character = player.Character
    
    if character then
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        
        if humanoid then
            humanoid.AutoRotate = true
        end
    end
end

--------------------------------------------------
-- BOTÃO
--------------------------------------------------

button.Activated:Connect(function()
    
    if shiftLock then
        desativarShiftLock()
    else
        ativarShiftLock()
    end
    
end)

--------------------------------------------------
-- RESPAWN
--------------------------------------------------

player.CharacterAdded:Connect(function(character)
    
    -- Aguarda o personagem carregar
    character:WaitForChild("Humanoid")
    character:WaitForChild("HumanoidRootPart")
    
    if shiftLock then
        
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        
        if humanoid then
            humanoid.AutoRotate = false
        end
        
    end
    
end)

4,232 chars · codepastes.com