
KeylessUniversal

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local Camera = Workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
-- Configuration
local ESPEnabled = true
local ESPColor = Color3.new(1, 0, 0) -- Red for boxes
local ESPThickness = 1
local activeDrawings = {}
-- Helper function to create a player's visual elements (Box + Health Bar)
local function createVisuals()
local visuals = {}
-- Main ESP Box
visuals.Box = Drawing.new("Square")
visuals.Box.Visible = false
visuals.Box.Color = ESPColor
visuals.Box.Thickness = ESPThickness
visuals.Box.Filled = false
-- Health Bar Background (Outline)
visuals.HealthBarBg = Drawing.new("Line")
visuals.HealthBarBg.Visible = false
visuals.HealthBarBg.Color = Color3.new(0, 0, 0)
visuals.HealthBarBg.Thickness = 3
-- Health Bar Fill (Dynamic)
visuals.HealthBar = Drawing.new("Line")
visuals.HealthBar.Visible = false
visuals.HealthBar.Color = Color3.new(0, 1, 0) -- Green
visuals.HealthBar.Thickness = 1
return visuals
end
-- Helper function to clean up a player's drawings
local function removeVisuals(player)
if activeDrawings[player] then
activeDrawings[player].Box:Remove()
activeDrawings[player].HealthBarBg:Remove()
activeDrawings[player].HealthBar:Remove()
activeDrawings[player] = nil
end
end
-- Initialize tracking for existing players
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer then
activeDrawings[player] = createVisuals()
end
end
-- Handle new players joining
Players.PlayerAdded:Connect(function(player)
if player ~= LocalPlayer then
activeDrawings[player] = createVisuals()
end
end)
-- Handle players leaving (cleanup memory)
Players.PlayerRemoving:Connect(function(player)
removeVisuals(player)
end)
-- Centralized render loop (runs every frame)
RunService.RenderStepped:Connect(function()
if not ESPEnabled then
for _, visuals in pairs(activeDrawings) do
visuals.Box.Visible = false
visuals.HealthBarBg.Visible = false
visuals.HealthBar.Visible = false
end
return
end
for player, visuals in pairs(activeDrawings) do
local character = player.Character
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
-- Verify character validity and life state
if character and rootPart and humanoid and humanoid.Health > 0 then
-- Project 3D world position to 2D screen space (Z represents distance/depth)
local vector, onScreen = Camera:WorldToViewportPoint(rootPart.Position)
if onScreen then
-- Distance-based sizing: Scale inversely with depth (vector.Z)
local distance = vector.Z
local boxHeight = math.clamp(2500 / distance, 15, 800)
local boxWidth = boxHeight * 0.6
local boxX = vector.X - (boxWidth / 2)
local boxY = vector.Y - (boxHeight / 2)
-- Update main box
visuals.Box.Size = Vector2.new(boxWidth, boxHeight)
visuals.Box.Position = Vector2.new(boxX, boxY)
visuals.Box.Visible = true
-- Health Bar Calculations
local healthPercent = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1)
local currentHealthHeight = boxHeight * healthPercent
-- Position health bar just to the left of the box
local barX = boxX - 6
local barTopY = boxY
local barBottomY = boxY + boxHeight
-- Update Health Bar Background (full height)
visuals.HealthBarBg.From = Vector2.new(barX, barBottomY)
visuals.HealthBarBg.To = Vector2.new(barX, barTopY)
visuals.HealthBarBg.Visible = true
-- Update Health Bar Fill (scaled by health percentage, starting from bottom)
visuals.HealthBar.From = Vector2.new(barX, barBottomY)
visuals.HealthBar.To = Vector2.new(barX, barBottomY - currentHealthHeight)
-- Optional: Shift color from green to red as health drops
visuals.HealthBar.Color = Color3.new(1 - healthPercent, healthPercent, 0)
visuals.HealthBar.Visible = true
else
visuals.Box.Visible = false
visuals.HealthBarBg.Visible = false
visuals.HealthBar.Visible = false
end
else
visuals.Box.Visible = false
visuals.HealthBarBg.Visible = false
visuals.HealthBar.Visible = false
end
end
end)
-- Toggle ESP with the F9 key
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.KeyCode == Enum.KeyCode.F9 then
ESPEnabled = not ESPEnabled
if not ESPEnabled then
for _, visuals in pairs(activeDrawings) do
visuals.Box.Visible = false
visuals.HealthBarBg.Visible = false
visuals.HealthBar.Visible = false
end
end
end
end)No comments yet for this script.



