
KeylessUniversal

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local RunService = game:GetService("RunService")
if game:GetService("CoreGui"):FindFirstChild("AutoLockGUI") then return end
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoLockGUI"
screenGui.Parent = game:GetService("CoreGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 250, 0, 120)
frame.Position = UDim2.new(0, 100, 0, 100)
frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
frame.BorderSizePixel = 0
frame.Parent = screenGui
local topBar = Instance.new("Frame")
topBar.Size = UDim2.new(1, 0, 0, 30)
topBar.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
topBar.Parent = frame
local title = Instance.new("TextLabel")
title.Text = "Auto Lock"
title.Size = UDim2.new(0.6, 0, 1, 0)
title.BackgroundTransparency = 1
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.TextXAlignment = Enum.TextXAlignment.Left
title.Position = UDim2.new(0.05, 0, 0, 0)
title.Parent = topBar
local minimizeButton = Instance.new("TextButton")
minimizeButton.Size = UDim2.new(0, 30, 1, 0)
minimizeButton.Position = UDim2.new(0.75, 0, 0, 0)
minimizeButton.Text = "-"
minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
minimizeButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
minimizeButton.Parent = topBar
local closeButton = Instance.new("TextButton")
closeButton.Size = UDim2.new(0, 30, 1, 0)
closeButton.Position = UDim2.new(0.875, 0, 0, 0)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
closeButton.BackgroundColor3 = Color3.fromRGB(200, 0, 0)
closeButton.Parent = topBar
local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(0.9, 0, 0, 50)
toggleButton.Position = UDim2.new(0.05, 0, 0.35, 0)
toggleButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleButton.Text = "Toggle Auto-Lock OFF"
toggleButton.Parent = frame
frame.Active = true
frame.Draggable = true
local autoLockEnabled = false
local currentTarget = nil
local minimized = false
local mouseConnection
local renderConnection
local function enableAutoLock()
if mouseConnection or renderConnection then return end
mouseConnection = Mouse.Button1Down:Connect(function()
local target = Mouse.Target
if target and target.Parent then
local player = Players:GetPlayerFromCharacter(target.Parent)
if player then
currentTarget = player
end
end
end)
renderConnection = RunService.RenderStepped:Connect(function()
if currentTarget and currentTarget.Character and currentTarget.Character:FindFirstChild("HumanoidRootPart") then
local hrp = currentTarget.Character.HumanoidRootPart
workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, hrp.Position)
end
end)
end
local function disableAutoLock()
currentTarget = nil
if mouseConnection then
mouseConnection:Disconnect()
mouseConnection = nil
end
if renderConnection then
renderConnection:Disconnect()
renderConnection = nil
end
end
toggleButton.MouseButton1Click:Connect(function()
autoLockEnabled = not autoLockEnabled
toggleButton.Text = autoLockEnabled and "Toggle Auto-Lock ON" or "Toggle Auto-Lock OFF"
if autoLockEnabled then
enableAutoLock()
else
disableAutoLock()
end
end)
minimizeButton.MouseButton1Click:Connect(function()
minimized = not minimized
if minimized then
toggleButton.Visible = false
frame.Size = UDim2.new(0, 250, 0, 30)
minimizeButton.Text = "+"
else
toggleButton.Visible = true
frame.Size = UDim2.new(0, 250, 0, 120)
minimizeButton.Text = "-"
end
end)
closeButton.MouseButton1Click:Connect(function()
autoLockEnabled = false
disableAutoLock()
screenGui:Destroy()
end)No comments yet for this script.



