Lock Position
Key RequiredUniversal

Lock Position

Universal Scriptstyearstyear 1.9K views 2.1K executesUpdated Feb 22, 2026
5.0/ 5(3 votes)
30100% Positive
Lua Script•149 lines (3967 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

local function getCharacter()
    return player.Character or player.CharacterAdded:Wait()
end

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "LockPositionGui"
ScreenGui.IgnoreGuiInset = true
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = PlayerGui

local CircleBG = Instance.new("ImageLabel")
CircleBG.Size = UDim2.new(0,64,0,64)
CircleBG.AnchorPoint = Vector2.new(1,0)
CircleBG.Position = UDim2.new(1,-20,0,20)
CircleBG.BackgroundTransparency = 1
CircleBG.Image = "rbxassetid://16803802267"
CircleBG.ScaleType = Enum.ScaleType.Stretch
CircleBG.Parent = ScreenGui

local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(1,0)
UICorner.Parent = CircleBG

local LockButton = Instance.new("ImageButton")
LockButton.Size = UDim2.new(0.6,0,0.6,0)
LockButton.Position = UDim2.new(0.2,0,0.2,0)
LockButton.BackgroundTransparency = 1
LockButton.Image = "rbxassetid://130543358351438"
LockButton.Parent = CircleBG

local locked = false
local savedCFrame
local connection
local originalWalkSpeed
local originalJumpPower

local function startLock(char)
    if not char then return end
    
    local hrp = char:FindFirstChild("HumanoidRootPart")
    local humanoid = char:FindFirstChild("Humanoid")
    
    if not hrp or not humanoid then return end

    originalWalkSpeed = humanoid.WalkSpeed
    originalJumpPower = humanoid.JumpPower

    humanoid.WalkSpeed = 0
    humanoid.JumpPower = 0
    humanoid.AutoRotate = false

    savedCFrame = hrp.CFrame

    hrp.AssemblyLinearVelocity = Vector3.zero
    hrp.AssemblyAngularVelocity = Vector3.zero

    if connection then
        connection:Disconnect()
        connection = nil
    end

    connection = RunService.Heartbeat:Connect(function()
        if locked and hrp and hrp.Parent then
            pcall(function()
                hrp.CFrame = savedCFrame
                hrp.AssemblyLinearVelocity = Vector3.zero
                hrp.AssemblyAngularVelocity = Vector3.zero
            end)
        end
    end)
end

local function stopLock(char)
    if not char then return end
    
    local hrp = char:FindFirstChild("HumanoidRootPart")
    local humanoid = char:FindFirstChild("Humanoid")
    
    if not hrp or not humanoid then return end

    if connection then
        connection:Disconnect()
        connection = nil
    end

    humanoid.WalkSpeed = originalWalkSpeed or 16
    humanoid.JumpPower = originalJumpPower or 50
    humanoid.AutoRotate = true

    hrp.AssemblyLinearVelocity = Vector3.zero
    hrp.AssemblyAngularVelocity = Vector3.zero

    savedCFrame = nil
end

LockButton.MouseButton1Click:Connect(function()
    locked = not locked
    local char = getCharacter()

    if locked then
        LockButton.Image = "rbxassetid://80521861325317"
        startLock(char)
    else
        LockButton.Image = "rbxassetid://130543358351438"
        stopLock(char)
    end
end)

player.CharacterAdded:Connect(function(char)
    char:WaitForChild("HumanoidRootPart")
    char:WaitForChild("Humanoid")
    
    task.wait(0.1)
    if locked then
        startLock(char)
    end
end)

player.CharacterRemoving:Connect(function()
    if connection then
        connection:Disconnect()
        connection = nil
    end
end)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    if input.KeyCode == Enum.KeyCode.L then
        locked = not locked
        local char = getCharacter()

        if locked then
            LockButton.Image = "rbxassetid://80521861325317"
            startLock(char)
        else
            LockButton.Image = "rbxassetid://130543358351438"
            stopLock(char)
        end
    end
end)

Features & Information

Lock position to lock player position in all games that have auto teleport feature. Very good for afk farm
#Roblox#Exploit#Roblox studio#StyearX

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts