local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")
-- ==========================================
-- CONFIGURATION
-- ==========================================
local DEFAULTS = {
FOV_RADIUS = 150,
MAX_DISTANCE = 500,
TOGGLE_KEY = Enum.KeyCode.T,
MENU_KEY = Enum.KeyCode.Delete,
HIGHLIGHT_COLOR = Color3.fromRGB(255, 0, 0),
}
local SETTINGS = {
FOV_RADIUS = DEFAULTS.FOV_RADIUS,
MAX_DISTANCE = DEFAULTS.MAX_DISTANCE,
LOCK_BUTTON = Enum.UserInputType.MouseButton2,
TOGGLE_KEY = DEFAULTS.TOGGLE_KEY,
MENU_KEY = DEFAULTS.MENU_KEY,
CIRCLE_THICKNESS = 2,
IDLE_COLOR = Color3.fromRGB(255, 255, 255),
LOCKED_COLOR = DEFAULTS.HIGHLIGHT_COLOR,
HIGHLIGHT_COLOR = DEFAULTS.HIGHLIGHT_COLOR,
FLASH_COLOR = Color3.fromRGB(255, 215, 0),
VISIBILITY_BUFFER = 0.15,
}
local camera = Workspace.CurrentCamera
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local isEnabled = true
local isHolding = false
local lockedTarget = nil
local lastVisibleTime = 0
local changingKey = nil
local isFlashing = false
-- ==========================================
-- FLOATING NOTIFICATION
-- ==========================================
local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
screenGui.ResetOnSpawn = false
local statusLabel = Instance.new("TextLabel", screenGui)
statusLabel.Size = UDim2.new(0, 220, 0, 40)
statusLabel.Position = UDim2.new(0.5, -110, 0.85, 0)
statusLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
statusLabel.TextSize = 18
statusLabel.Font = Enum.Font.GothamBold
statusLabel.TextTransparency = 1
statusLabel.BackgroundTransparency = 1
Instance.new("UICorner", statusLabel)
local function notify(mode)
if mode == "ON" then statusLabel.Text = "SYSTEM ENABLED" statusLabel.TextColor3 = Color3.fromRGB(0, 255, 127)
elseif mode == "OFF" then statusLabel.Text = "SYSTEM DISABLED" statusLabel.TextColor3 = Color3.fromRGB(255, 85, 85)
elseif mode == "UPDATE" then statusLabel.Text = "SETTING UPDATED" statusLabel.TextColor3 = Color3.fromRGB(85, 170, 255)
elseif mode == "RESET" then statusLabel.Text = "SETTINGS RESET" statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255) end
TweenService:Create(statusLabel, TweenInfo.new(0.3), {TextTransparency = 0, BackgroundTransparency = 0.5}):Play()
task.wait(1.2)
TweenService:Create(statusLabel, TweenInfo.new(0.5), {TextTransparency = 1, BackgroundTransparency = 1}):Play()
end
-- ==========================================
-- SETTINGS MENU
-- ==========================================
local mainFrame = Instance.new("Frame", screenGui)
mainFrame.Size = UDim2.new(0, 260, 0, 400)
mainFrame.Position = UDim2.new(0.5, -130, 0.5, -200)
mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
mainFrame.Visible = false
mainFrame.Active = true
mainFrame.Draggable = true
Instance.new("UICorner", mainFrame)
local title = Instance.new("TextLabel", mainFrame)
title.Size = UDim2.new(1, 0, 0, 45)
title.Text = "NPC LOCK MENU"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.BackgroundTransparency = 1
title.Font = Enum.Font.GothamBold
title.TextSize = 20
local boxes = {}
local function createControl(name, yPos, default, callback)
local label = Instance.new("TextLabel", mainFrame)
label.Size = UDim2.new(1, -20, 0, 20)
label.Position = UDim2.new(0, 10, 0, yPos)
label.Text = name
label.TextColor3 = Color3.fromRGB(200, 200, 200)
label.BackgroundTransparency = 1
label.TextXAlignment = Enum.TextXAlignment.Left
label.Font = Enum.Font.Gotham
local box = Instance.new("TextBox", mainFrame)
box.Size = UDim2.new(0, 80, 0, 24)
box.Position = UDim2.new(1, -90, 0, yPos - 2)
box.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
box.Text = tostring(default)
box.TextColor3 = Color3.fromRGB(255, 255, 255)
Instance.new("UICorner", box)
boxes[name] = box
box.FocusLost:Connect(function() callback(box) task.spawn(notify, "UPDATE") end)
end
createControl("FOV Radius", 60, SETTINGS.FOV_RADIUS, function(b) SETTINGS.FOV_RADIUS = tonumber(b.Text) or SETTINGS.FOV_RADIUS end)
createControl("Max Studs", 100, SETTINGS.MAX_DISTANCE, function(b) SETTINGS.MAX_DISTANCE = tonumber(b.Text) or SETTINGS.MAX_DISTANCE end)
createControl("Highlight RGB", 140, "255,0,0", function(b)
local r, g, bl = b.Text:match("(%d+),(%d+),(%d+)")
if r and g and bl then SETTINGS.HIGHLIGHT_COLOR = Color3.fromRGB(tonumber(r), tonumber(g), tonumber(bl)) SETTINGS.LOCKED_COLOR = SETTINGS.HIGHLIGHT_COLOR end
end)
local keyButton = Instance.new("TextButton", mainFrame)
keyButton.Size = UDim2.new(1, -20, 0, 35)
keyButton.Position = UDim2.new(0, 10, 0, 180)
keyButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
keyButton.Text = "System Toggle: " .. SETTINGS.TOGGLE_KEY.Name
keyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
Instance.new("UICorner", keyButton)
keyButton.MouseButton1Click:Connect(function() changingKey = "TOGGLE" keyButton.Text = "...Press Key..." end)
local menuKeyButton = Instance.new("TextButton", mainFrame)
menuKeyButton.Size = UDim2.new(1, -20, 0, 35)
menuKeyButton.Position = UDim2.new(0, 10, 0, 225)
menuKeyButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
menuKeyButton.Text = "Menu Key: " .. SETTINGS.MENU_KEY.Name
menuKeyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
Instance.new("UICorner", menuKeyButton)
menuKeyButton.MouseButton1Click:Connect(function() changingKey = "MENU" menuKeyButton.Text = "...Press Key..." end)
local resetBtn = Instance.new("TextButton", mainFrame)
resetBtn.Size = UDim2.new(1, -20, 0, 35)
resetBtn.Position = UDim2.new(0, 10, 0, 270)
resetBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
resetBtn.Text = "RESET TO DEFAULT"
resetBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
Instance.new("UICorner", resetBtn)
resetBtn.MouseButton1Click:Connect(function()
SETTINGS.FOV_RADIUS = DEFAULTS.FOV_RADIUS SETTINGS.MAX_DISTANCE = DEFAULTS.MAX_DISTANCE SETTINGS.TOGGLE_KEY = DEFAULTS.TOGGLE_KEY SETTINGS.MENU_KEY = DEFAULTS.MENU_KEY SETTINGS.HIGHLIGHT_COLOR = DEFAULTS.HIGHLIGHT_COLOR SETTINGS.LOCKED_COLOR = DEFAULTS.HIGHLIGHT_COLOR
boxes["FOV Radius"].Text = tostring(DEFAULTS.FOV_RADIUS) boxes["Max Studs"].Text = tostring(DEFAULTS.MAX_DISTANCE) boxes["Highlight RGB"].Text = "255,0,0"
keyButton.Text = "System Toggle: " .. SETTINGS.TOGGLE_KEY.Name
menuKeyButton.Text = "Menu Key: " .. SETTINGS.MENU_KEY.Name
task.spawn(notify, "RESET")
end)
-- ==========================================
-- ENHANCED STACKED HUD
-- ==========================================
local BASE_WIDTH, HUD_HEIGHT = 180, 56
local healthOutline = Drawing.new("Square") healthOutline.Thickness = 1 healthOutline.Filled = true healthOutline.Color = Color3.fromRGB(0, 0, 0) healthOutline.Visible = false
local healthBG = Drawing.new("Square") healthBG.Thickness = 1 healthBG.Filled = true healthBG.Color = Color3.fromRGB(40, 40, 40) healthBG.Visible = false
local healthMain = Drawing.new("Square") healthMain.Thickness = 1 healthMain.Filled = true healthMain.Visible = false
local nameText = Drawing.new("Text") nameText.Size = 16 nameText.Center = true nameText.Font = 3 nameText.Visible = false
local hpNumText = Drawing.new("Text") hpNumText.Size = 16 hpNumText.Center = true hpNumText.Font = 3 hpNumText.Visible = false
local hpPercText = Drawing.new("Text") hpPercText.Size = 15 hpPercText.Center = true hpPercText.Font = 3 hpPercText.Visible = false
-- ==========================================
-- CORE LOGIC
-- ==========================================
local targetHighlight = Instance.new("Highlight", game:GetService("CoreGui"))
targetHighlight.Enabled = false
local fovCircle = Drawing.new("Circle") fovCircle.Thickness = SETTINGS.CIRCLE_THICKNESS fovCircle.NumSides = 64 fovCircle.Visible = isEnabled fovCircle.Color = SETTINGS.IDLE_COLOR
local function isVisible(targetPart)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {character, targetPart.Parent}
return Workspace:Raycast(camera.CFrame.Position, (targetPart.Position - camera.CFrame.Position), params) == nil
end
local function getClosestNPC()
if not isEnabled then return nil end
local closestNPC, shortestDist = nil, SETTINGS.FOV_RADIUS
local mousePos = UserInputService:GetMouseLocation()
for _, npc in pairs(CollectionService:GetTagged("NPC")) do
local head = npc:FindFirstChild("Head")
local hum = npc:FindFirstChildOfClass("Humanoid")
if head and hum and hum.Health > 0 and not Players:GetPlayerFromCharacter(npc) then
if (camera.CFrame.Position - head.Position).Magnitude <= SETTINGS.MAX_DISTANCE then
local screenPos, onScreen = camera:WorldToViewportPoint(head.Position)
if onScreen then
local dist = (Vector2.new(screenPos.X, screenPos.Y) - mousePos).Magnitude
if dist < shortestDist and isVisible(head) then shortestDist = dist closestNPC = head end
end
end
end
end
return closestNPC
end
UserInputService.InputBegan:Connect(function(input, gp)
if changingKey then
if input.KeyCode ~= Enum.KeyCode.Unknown then
if changingKey == "TOGGLE" then
SETTINGS.TOGGLE_KEY = input.KeyCode
keyButton.Text = "System Toggle: " .. SETTINGS.TOGGLE_KEY.Name
else
SETTINGS.MENU_KEY = input.KeyCode
menuKeyButton.Text = "Menu Key: " .. SETTINGS.MENU_KEY.Name
end
changingKey = nil
task.spawn(notify, "UPDATE")
end
return
end
if input.KeyCode == SETTINGS.MENU_KEY then mainFrame.Visible = not mainFrame.Visible end
if gp then return end
if input.KeyCode == SETTINGS.TOGGLE_KEY then
isEnabled = not isEnabled fovCircle.Visible = isEnabled task.spawn(notify, isEnabled and "ON" or "OFF")
if not isEnabled then isHolding = false lockedTarget = nil targetHighlight.Enabled = false healthOutline.Visible = false healthBG.Visible = false healthMain.Visible = false hpNumText.Visible = false hpPercText.Visible = false nameText.Visible = false end
end
if input.UserInputType == SETTINGS.LOCK_BUTTON and isEnabled then isHolding = true end
end)
UserInputService.InputEnded:Connect(function(input) if input.UserInputType == SETTINGS.LOCK_BUTTON then isHolding = false lockedTarget = nil healthOutline.Visible = false healthBG.Visible = false healthMain.Visible = false hpNumText.Visible = false hpPercText.Visible = false nameText.Visible = false end end)
RunService.RenderStepped:Connect(function()
fovCircle.Radius = SETTINGS.FOV_RADIUS targetHighlight.OutlineColor = SETTINGS.HIGHLIGHT_COLOR targetHighlight.FillColor = SETTINGS.HIGHLIGHT_COLOR
if not isEnabled then return end
local mousePos = UserInputService:GetMouseLocation()
fovCircle.Position = mousePos
local potentialTarget = getClosestNPC()
local activeTarget = lockedTarget or potentialTarget
if activeTarget and not isFlashing then fovCircle.Color = SETTINGS.LOCKED_COLOR targetHighlight.Adornee = activeTarget.Parent targetHighlight.Enabled = true
elseif not isFlashing then fovCircle.Color = SETTINGS.IDLE_COLOR targetHighlight.Enabled = false end
if isHolding then
if not lockedTarget then lockedTarget = potentialTarget if lockedTarget then lastVisibleTime = tick() end end
if lockedTarget then
local hum = lockedTarget.Parent:FindFirstChildOfClass("Humanoid")
if not lockedTarget.Parent or (hum and hum.Health SETTINGS.VISIBILITY_BUFFER then lockedTarget = nil healthOutline.Visible = false healthBG.Visible = false healthMain.Visible = false hpNumText.Visible = false hpPercText.Visible = false nameText.Visible = false return end
local maxHP = hum.MaxHealth local dynamicWidth = BASE_WIDTH + math.clamp((maxHP - 100) * 0.1, 0, 300) local hpPercent = math.clamp(hum.Health / maxHP, 0, 1) local barX = mousePos.X - (dynamicWidth / 2) local barY = mousePos.Y + SETTINGS.FOV_RADIUS + 15
healthOutline.Size = Vector2.new(dynamicWidth + 4, HUD_HEIGHT + 4) healthOutline.Position = Vector2.new(barX - 2, barY - 2)
healthBG.Size = Vector2.new(dynamicWidth, HUD_HEIGHT) healthBG.Position = Vector2.new(barX, barY)
healthMain.Position = Vector2.new(barX, barY) healthMain.Size = Vector2.new(dynamicWidth * hpPercent, HUD_HEIGHT)
local barColor = Color3.fromHSV(hpPercent * 0.3, 0.8, 1) local h, s, v = barColor:ToHSV() local textColor = Color3.fromHSV(h, s, v * 0.6)
healthMain.Color = barColor hpNumText.Color = textColor hpPercText.Color = textColor nameText.Color = textColor
nameText.Position = Vector2.new(mousePos.X, barY + 4) nameText.Text = lockedTarget.Parent.Name
hpNumText.Position = Vector2.new(mousePos.X, barY + 20) hpNumText.Text = string.format("%d / %d", math.floor(hum.Health), math.floor(maxHP))
hpPercText.Position = Vector2.new(mousePos.X, barY + 36) hpPercText.Text = string.format("[%d%%]", math.floor(hpPercent * 100))
healthOutline.Visible = true healthBG.Visible = true healthMain.Visible = true hpNumText.Visible = true hpPercText.Visible = true nameText.Visible = true
camera.CFrame = CFrame.new(camera.CFrame.Position, lockedTarget.Position)
end
else healthOutline.Visible = false healthBG.Visible = false healthMain.Visible = false hpNumText.Visible = false hpPercText.Visible = false nameText.Visible = false end
end)