
KeylessUniversal

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local localPlayer = Players.LocalPlayer
local camera = Workspace.CurrentCamera
-- --- CONFIGURATION ---
local AIM_SETTINGS = {
Enabled = true,
FOV = 150, -- Radius of the FOV circle (in pixels)
Smoothness = 0.15, -- Lower = smoother/slower, Higher = snappier (Value between 0 and 1)
}
local FOV_SETTINGS = {
Visible = true,
Color = Color3.fromRGB(0, 0, 0), -- Black Circle
Thickness = 1.5,
NumSides = 64, -- Makes the circle look smooth
}
local ESP_SETTINGS = {
BoxColor = Color3.fromRGB(0, 0, 0), -- Black border outline
HighlightColor = Color3.fromRGB(186, 85, 211) -- Purple fill/highlight
}
-- --- INITIALIZATION ---
-- Create the FOV Circle using the Drawing API
local fovCircle = Drawing.new("Circle")
fovCircle.Visible = FOV_SETTINGS.Visible
fovCircle.Color = FOV_SETTINGS.Color
fovCircle.Thickness = FOV_SETTINGS.Thickness
fovCircle.NumSides = FOV_SETTINGS.NumSides
fovCircle.Radius = AIM_SETTINGS.FOV
fovCircle.Filled = false
-- Table to keep track of Highlights for ESP
local playerHighlights = {}
-- --- FUNCTIONS ---
-- Function to check if a target is valid and alive
local function isValidTarget(player)
return player ~= localPlayer
and player.Character
and player.Character:FindFirstChild("HumanoidRootPart")
and player.Character:FindFirstChild("Humanoid")
and player.Character.Humanoid.Health > 0
end
-- Function to find the closest player inside the FOV circle
local function getClosestPlayerToCursor()
local closestPlayer = nil
local shortestDistance = AIM_SETTINGS.FOV
local mousePosition = UserInputService:GetMouseLocation()
for _, player in ipairs(Players:GetPlayers()) do
if isValidTarget(player) then
local rootPart = player.Character.HumanoidRootPart
-- Convert the 3D world position of the player to 2D screen space
local screenPosition, onScreen = camera:WorldToViewportPoint(rootPart.Position)
if onScreen then
-- Calculate how far the target is from the center of the screen/mouse
local distance = (Vector2.new(screenPosition.X, screenPosition.Y) - mousePosition).Magnitude
if distance < shortestDistance then
shortestDistance = distance
closestPlayer = player
end
end
end
end
return closestPlayer
end
-- Manage modern Highlights for the purple character glow
local function updateESP()
for _, player in ipairs(Players:GetPlayers()) do
if isValidTarget(player) then
local character = player.Character
local highlight = playerHighlights[player]
if not highlight then
-- Create a new Highlight object if it doesn't exist
highlight = Instance.new("Highlight")
highlight.Name = "ESPHighlight"
highlight.FillColor = ESP_SETTINGS.HighlightColor
highlight.FillTransparency = 0.5 -- Semi-transparent purple fill
highlight.OutlineColor = ESP_SETTINGS.BoxColor
highlight.OutlineTransparency = 0 -- Solid black outline
highlight.Parent = character
playerHighlights[player] = highlight
else
-- Ensure it stays parented correctly if the character updates
if highlight.Parent ~= character then
highlight.Parent = character
end
end
else
-- Clean up if the player leaves or dies
if playerHighlights[player] then
playerHighlights[player]:Destroy()
playerHighlights[player] = nil
end
end
end
end
-- Clean up highlights when a player leaves the game
Players.PlayerRemoving:Connect(function(player)
if playerHighlights[player] then
playerHighlights[player]:Destroy()
playerHighlights[player] = nil
end
end)
-- --- MAIN LOOP ---
RunService.RenderStepped:Connect(function()
local mousePosition = UserInputService:GetMouseLocation()
-- Update the FOV Circle position to match the mouse cursor
fovCircle.Position = mousePosition
-- ESP Box/Highlight Update
updateESP()
-- Smooth Aim Logic
if AIM_SETTINGS.Enabled then
local target = getClosestPlayerToCursor()
if target and target.Character and target.Character:FindFirstChild("HumanoidRootPart") then
local targetPosition = target.Character.HumanoidRootPart.Position
-- Generate a LookAt orientation facing the target
local targetCFrame = CFrame.new(camera.CFrame.Position, targetPosition)
-- Smoothly interpolate (Lerp) the camera's rotation toward the target
camera.CFrame = camera.CFrame:Lerp(targetCFrame, AIM_SETTINGS.Smoothness)
end
end
end)No comments yet for this script.



