
KeylessUniversal

-- Settings
local Settings = {
Box_Thickness = 2,
Autothickness = true
}
local Space = game:GetService("Workspace")
local Player = game:GetService("Players").LocalPlayer
local Camera = Space.CurrentCamera
local PlayerGui = Player:WaitForChild("PlayerGui")
local espActive = true
local allConnections = {}
local allParts = {}
local allDrawings = {}
local function healthColor(ratio)
ratio = math.clamp(ratio, 0, 1)
if ratio >= 0.5 then
local t = (1 - ratio) * 2
return Color3.new(t, 1, 0)
else
local t = ratio * 2
return Color3.new(1, t, 0)
end
end
local function NewLine(color, thickness)
local line = Drawing.new("Line")
line.Visible = false
line.From = Vector2.new(0,0)
line.To = Vector2.new(0,0)
line.Color = color
line.Thickness = thickness
line.Transparency = 1
return line
end
local function NewText(size)
local t = Drawing.new("Text")
t.Visible = false
t.Center = true
t.Outline = true
t.Size = size or 13
t.Font = Drawing.Fonts.UI
t.Transparency = 1
t.Color = Color3.new(1,1,1)
return t
end
local function Vis(lib, state)
for _, v in pairs(lib) do v.Visible = state end
end
local function Colorize(lib, color)
for _, v in pairs(lib) do v.Color = color end
end
local function Main(plr)
repeat wait() until plr.Character ~= nil
and plr.Character:FindFirstChild("Humanoid") ~= nil
local Library = {
TL1 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
TL2 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
TR1 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
TR2 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
BL1 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
BL2 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
BR1 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
BR2 = NewLine(Color3.new(1,1,1), Settings.Box_Thickness),
}
local nameText = NewText(13) -- display name above box
local hpText = NewText(13)
local distText = NewText(12)
for _, v in pairs(Library) do table.insert(allDrawings, v) end
table.insert(allDrawings, nameText)
table.insert(allDrawings, hpText)
table.insert(allDrawings, distText)
local oripart = Instance.new("Part")
oripart.Parent = Space
oripart.Transparency = 1
oripart.CanCollide = false
oripart.Anchored = true
oripart.Size = Vector3.new(1,1,1)
table.insert(allParts, oripart)
local function Updater()
local c
c = game:GetService("RunService").RenderStepped:Connect(function()
local char = plr.Character
local hum = char and char:FindFirstChild("Humanoid")
local hrp = char and char:FindFirstChild("HumanoidRootPart")
if not espActive then
Vis(Library, false)
nameText.Visible = false
hpText.Visible = false
distText.Visible = false
return
end
if char and hum and hrp and hum.Health > 0 then
local _, vis = Camera:WorldToViewportPoint(hrp.Position)
if vis then
local teamCol = plr.Team and plr.TeamColor.Color or Color3.new(1,1,1)
Colorize(Library, teamCol)
oripart.Size = Vector3.new(hrp.Size.X, hrp.Size.Y * 1.5, hrp.Size.Z)
oripart.CFrame = CFrame.new(hrp.CFrame.Position, Camera.CFrame.Position)
local SizeX = oripart.Size.X
local SizeY = oripart.Size.Y
local TL = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new( SizeX, SizeY, 0)).p)
local TR = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(-SizeX, SizeY, 0)).p)
local BL = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new( SizeX, -SizeY, 0)).p)
local BR = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(-SizeX, -SizeY, 0)).p)
local ratio = (Camera.CFrame.p - hrp.Position).Magnitude
local offset = math.clamp(1/ratio * 750, 2, 300)
Library.TL1.From = Vector2.new(TL.X,TL.Y) ; Library.TL1.To = Vector2.new(TL.X+offset,TL.Y)
Library.TL2.From = Vector2.new(TL.X,TL.Y) ; Library.TL2.To = Vector2.new(TL.X,TL.Y+offset)
Library.TR1.From = Vector2.new(TR.X,TR.Y) ; Library.TR1.To = Vector2.new(TR.X-offset,TR.Y)
Library.TR2.From = Vector2.new(TR.X,TR.Y) ; Library.TR2.To = Vector2.new(TR.X,TR.Y+offset)
Library.BL1.From = Vector2.new(BL.X,BL.Y) ; Library.BL1.To = Vector2.new(BL.X+offset,BL.Y)
Library.BL2.From = Vector2.new(BL.X,BL.Y) ; Library.BL2.To = Vector2.new(BL.X,BL.Y-offset)
Library.BR1.From = Vector2.new(BR.X,BR.Y) ; Library.BR1.To = Vector2.new(BR.X-offset,BR.Y)
Library.BR2.From = Vector2.new(BR.X,BR.Y) ; Library.BR2.To = Vector2.new(BR.X,BR.Y-offset)
Vis(Library, true)
if Settings.Autothickness then
local lhrp = Player.Character and Player.Character:FindFirstChild("HumanoidRootPart")
local dist = lhrp and (lhrp.Position - hrp.Position).Magnitude or 100
local val = math.clamp(1/dist * 100, 1, 4)
for _, x in pairs(Library) do x.Thickness = val end
else
for _, x in pairs(Library) do x.Thickness = Settings.Box_Thickness end
end
local topY = math.min(TL.Y, TR.Y)
local botY = math.max(BL.Y, BR.Y)
local midX = (TL.X + TR.X) / 2
-- Display name above box
nameText.Text = plr.DisplayName
nameText.Color = teamCol
nameText.Position = Vector2.new(midX, topY - 16)
nameText.Visible = true
-- Health
local hpRatio = math.clamp(hum.Health / hum.MaxHealth, 0, 1)
hpText.Text = math.floor(hum.Health) .. "/" .. math.floor(hum.MaxHealth)
hpText.Color = healthColor(hpRatio)
hpText.Position = Vector2.new(midX, botY + 4)
hpText.Visible = true
-- Distance (number only)
local lhrp2 = Player.Character and Player.Character:FindFirstChild("HumanoidRootPart")
local studs = lhrp2 and math.floor((hrp.Position - lhrp2.Position).Magnitude) or 0
distText.Text = tostring(studs)
distText.Color = teamCol
distText.Position = Vector2.new(midX, botY + 18)
distText.Visible = true
else
Vis(Library, false)
nameText.Visible = false
hpText.Visible = false
distText.Visible = false
end
else
Vis(Library, false)
nameText.Visible = false
hpText.Visible = false
distText.Visible = false
if game:GetService("Players"):FindFirstChild(plr.Name) == nil then
for _, v in pairs(Library) do v:Remove() end
nameText:Remove() ; hpText:Remove() ; distText:Remove()
oripart:Destroy()
c:Disconnect()
end
end
end)
table.insert(allConnections, c)
end
coroutine.wrap(Updater)()
end
-- ================================================
-- GUI
-- ================================================
local gui = Instance.new("ScreenGui", PlayerGui)
gui.Name = "ESP_GUI"
gui.ResetOnSpawn = false
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
local panel = Instance.new("Frame", gui)
panel.Size = UDim2.new(0, 150, 0, 90)
panel.Position = UDim2.new(0, 18, 0.5, -45)
panel.BackgroundColor3 = Color3.fromRGB(10, 10, 16)
panel.BorderSizePixel = 0
panel.Active = true
panel.Draggable = true
Instance.new("UICorner", panel).CornerRadius = UDim.new(0, 8)
local stroke = Instance.new("UIStroke", panel)
stroke.Color = Color3.fromRGB(60, 60, 100) ; stroke.Thickness = 1
local titleBar = Instance.new("Frame", panel)
titleBar.Size = UDim2.new(1, 0, 0, 26)
titleBar.BackgroundColor3 = Color3.fromRGB(22, 22, 40)
titleBar.BorderSizePixel = 0
Instance.new("UICorner", titleBar).CornerRadius = UDim.new(0, 8)
local titleLbl = Instance.new("TextLabel", titleBar)
titleLbl.Size = UDim2.new(1, -10, 1, 0)
titleLbl.Position = UDim2.new(0, 10, 0, 0)
titleLbl.BackgroundTransparency = 1
titleLbl.Text = "ESP"
titleLbl.TextColor3 = Color3.fromRGB(180, 180, 255)
titleLbl.TextSize = 13
titleLbl.Font = Enum.Font.GothamBold
titleLbl.TextXAlignment = Enum.TextXAlignment.Left
local function makeBtn(yPos, text, r, g, b)
local btn = Instance.new("TextButton", panel)
btn.Size = UDim2.new(1, -16, 0, 26)
btn.Position = UDim2.new(0, 8, 0, yPos)
btn.BackgroundColor3 = Color3.fromRGB(r, g, b)
btn.BorderSizePixel = 0
btn.Text = text
btn.TextColor3 = Color3.new(1,1,1)
btn.TextSize = 12
btn.Font = Enum.Font.GothamBold
Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 5)
return btn
end
local toggleBtn = makeBtn(31, "ESP: ON", 35, 165, 85)
local closeBtn = makeBtn(61, "Close ESP", 160, 35, 35)
toggleBtn.MouseButton1Click:Connect(function()
espActive = not espActive
if espActive then
toggleBtn.Text = "ESP: ON"
toggleBtn.BackgroundColor3 = Color3.fromRGB(35, 165, 85)
else
toggleBtn.Text = "ESP: OFF"
toggleBtn.BackgroundColor3 = Color3.fromRGB(75, 75, 75)
end
end)
closeBtn.MouseButton1Click:Connect(function()
for _, c in ipairs(allConnections) do c:Disconnect() end
for _, d in ipairs(allDrawings) do pcall(function() d:Remove() end) end
for _, p in ipairs(allParts) do pcall(function() p:Destroy() end) end
gui:Destroy()
end)
-- Start
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Name ~= Player.Name then coroutine.wrap(Main)(v) end
end
game:GetService("Players").PlayerAdded:Connect(function(newplr)
coroutine.wrap(Main)(newplr)
end)No comments yet for this script.



