-- SilentLock V3 | KEYS : Q - Toggle On/Off / LMB - Force Off | xyz7 local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local StarterGui = game:GetService("StarterGui") local localPlayer = Players.LocalPlayer local camera = workspace.CurrentCamera local MAX_DISTANCE = 25 -- Change if using a gamepass local isLocked = false local targetCharacter = nil local connection = nil local unlockCamera local function getNearestPlayer() local character = localPlayer.Character if not character or not character:FindFirstChild("HumanoidRootPart") then return nil end local myPosition = character.HumanoidRootPart.Position local closestPlayer = nil local shortestDistance = MAX_DISTANCE for _, player in ipairs(Players:GetPlayers()) do if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local targetRoot = player.Character.HumanoidRootPart local distance = (myPosition - targetRoot.Position).Magnitude local humanoid = player.Character:FindFirstChildOfClass("Humanoid") if distance <= shortestDistance and humanoid and humanoid.Health > 0 then shortestDistance = distance closestPlayer = player.Character end end end return closestPlayer end local function lockCamera() local myCharacter = localPlayer.Character if myCharacter and myCharacter:FindFirstChild("HumanoidRootPart") and targetCharacter and targetCharacter:FindFirstChild("HumanoidRootPart") then local myPosition = myCharacter.HumanoidRootPart.Position local targetRoot = targetCharacter.HumanoidRootPart local distance = (myPosition - targetRoot.Position).Magnitude if distance <= MAX_DISTANCE then camera.CFrame = CFrame.new(camera.CFrame.Position, targetRoot.Position) else unlockCamera() end else unlockCamera() end end function unlockCamera() isLocked = false targetCharacter = nil if connection then connection:Disconnect() connection = nil end camera.CameraType = Enum.CameraType.Custom end local inputConnection = nil local function setupInputListener() if inputConnection then inputConnection:Disconnect() end unlockCamera() inputConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.Q then if isLocked then unlockCamera() else targetCharacter = getNearestPlayer() if targetCharacter then isLocked = true camera.CameraType = Enum.CameraType.Scriptable connection = RunService.RenderStepped:Connect(lockCamera) end end end if input.UserInputType == Enum.UserInputType.MouseButton1 then if isLocked then unlockCamera() end end end) end setupInputListener() localPlayer.CharacterAdded:Connect(setupInputListener) -- Shows notification when the script is running StarterGui:SetCore("SendNotification", { Title = "Silent Lock V3", Text = "Controls:\nQ : Toggle On/Off | LMB : Unlock", Duration = 4, }) -- Shows print command when the script is running print("SilentLock V3 is successfully running")