-- Beautiful GUI - Enemy Only Nearest Camera Lock for Arsenal Testing
-- Only locks on real enemies (not teammates)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local enabled = false
local connection = nil
local targetPartName = "Head" -- Change to "HumanoidRootPart" if you prefer body lock
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "ArsenalEnemyLockGUI"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
-- Main Frame
local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 340, 0, 190)
mainFrame.Position = UDim2.new(0.5, -170, 0.35, 0)
mainFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 24)
mainFrame.BorderSizePixel = 0
mainFrame.BackgroundTransparency = 0.05
mainFrame.Parent = screenGui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 14)
corner.Parent = mainFrame
local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(100, 150, 255)
stroke.Thickness = 2
stroke.Parent = mainFrame
-- Title Bar
local titleBar = Instance.new("Frame")
titleBar.Size = UDim2.new(1, 0, 0, 45)
titleBar.BackgroundColor3 = Color3.fromRGB(12, 12, 18)
titleBar.BorderSizePixel = 0
titleBar.Parent = mainFrame
local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 14)
titleCorner.Parent = titleBar
local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -50, 1, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Arsenal Enemy Camera Lock"
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextScaled = true
titleLabel.Font = Enum.Font.GothamBold
titleLabel.Parent = titleBar
-- Close Button
local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 35, 0, 35)
closeBtn.Position = UDim2.new(1, -40, 0, 5)
closeBtn.BackgroundColor3 = Color3.fromRGB(220, 60, 60)
closeBtn.Text = "✕"
closeBtn.TextColor3 = Color3.new(1,1,1)
closeBtn.TextScaled = true
closeBtn.Font = Enum.Font.GothamBold
closeBtn.Parent = titleBar
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 10)
closeCorner.Parent = closeBtn
-- Toggle Button
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0.88, 0, 0, 60)
toggleBtn.Position = UDim2.new(0.06, 0, 0, 65)
toggleBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
toggleBtn.Text = "ACTIVATE ENEMY LOCK"
toggleBtn.TextColor3 = Color3.new(1,1,1)
toggleBtn.TextScaled = true
toggleBtn.Font = Enum.Font.GothamBold
toggleBtn.Parent = mainFrame
local toggleCorner = Instance.new("UICorner")
toggleCorner.CornerRadius = UDim.new(0, 12)
toggleCorner.Parent = toggleBtn
-- Status
local statusLabel = Instance.new("TextLabel")
statusLabel.Size = UDim2.new(0.88, 0, 0, 25)
statusLabel.Position = UDim2.new(0.06, 0, 0, 140)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = "Status: Disabled"
statusLabel.TextColor3 = Color3.fromRGB(180, 180, 180)
statusLabel.TextScaled = true
statusLabel.Font = Enum.Font.Gotham
statusLabel.Parent = mainFrame
-- Draggable
local dragging = false
local dragStart, startPos
titleBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
dragStart = input.Position
startPos = mainFrame.Position
end
end)
UserInputService.InputChanged:Connect(function(input)
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local delta = input.Position - dragStart
mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = false
end
end)
closeBtn.MouseButton1Click:Connect(function()
screenGui:Destroy()
end)
-- ==================== CORE LOGIC ====================
local function isEnemy(targetPlayer)
if not targetPlayer or not targetPlayer.Team then return false end
if not player.Team then return true end -- If no team, everyone is enemy
return targetPlayer.Team ~= player.Team
end
local function getNearestEnemy()
local closest = nil
local shortestDist = math.huge
local myChar = player.Character
if not myChar or not myChar:FindFirstChild("HumanoidRootPart") then return nil end
for _, otherPlayer in ipairs(Players:GetPlayers()) do
if otherPlayer ~= player and isEnemy(otherPlayer) and otherPlayer.Character then
local targetPart = otherPlayer.Character:FindFirstChild(targetPartName)
if targetPart then
local dist = (camera.CFrame.Position - targetPart.Position).Magnitude
if dist < shortestDist and dist > 6 then
shortestDist = dist
closest = targetPart
end
end
end
end
return closest
end
local function onRender()
if not enabled then return end
local target = getNearestEnemy()
if not target then return end
-- Hard lock camera directly on enemy
local camPos = camera.CFrame.Position
local targetPos = target.Position + Vector3.new(0, 0.2, 0) -- slight upward offset for better head feel
camera.CFrame = CFrame.lookAt(camPos, targetPos)
end
-- Toggle Button
toggleBtn.MouseButton1Click:Connect(function()
enabled = not enabled
if enabled then
toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 220, 80)
toggleBtn.Text = "DEACTIVATE ENEMY LOCK"
statusLabel.Text = "Status: ENABLED - Locking nearest enemy"
statusLabel.TextColor3 = Color3.fromRGB(80, 255, 100)
if connection then connection:Disconnect() end
connection = RunService:BindToRenderStep("EnemyHardLock", Enum.RenderPriority.Camera.Value - 1, onRender)
else
toggleBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
toggleBtn.Text = "ACTIVATE ENEMY LOCK"
statusLabel.Text = "Status: Disabled"
statusLabel.TextColor3 = Color3.fromRGB(180, 180, 180)
if connection then
RunService:UnbindFromRenderStep("EnemyHardLock")
connection = nil
end
end
end)
print("✅ Beautiful Enemy-Only Camera Lock GUI loaded!")
print("Only targets real enemies, always pic
Comments
No comments yet
Be the first to share your thoughts!