-- CONFIG local DEFAULT_COLOR = Color3.fromRGB(255, 0, 0) local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local localPlayer = Players.LocalPlayer local playerGui = localPlayer:WaitForChild("PlayerGui") -- State local espEnabled = false local hudVisible = true local espObjects = {} local playerColors = {} local dragging = false local dragInput = nil local dragStart = nil local startPos = nil -- ScreenGui HUD local screenGui = Instance.new("ScreenGui") screenGui.Name = "ESPGUI" screenGui.ResetOnSpawn = false screenGui.Parent = playerGui -- Main HUD Frame local hudFrame = Instance.new("Frame") hudFrame.Size = UDim2.new(0, 220, 0, 300) hudFrame.Position = UDim2.new(0, 20, 0.5, -150) hudFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) hudFrame.BorderSizePixel = 0 hudFrame.Parent = screenGui local uiCorner = Instance.new("UICorner") uiCorner.CornerRadius = UDim.new(0, 8) uiCorner.Parent = hudFrame local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 35) title.BackgroundColor3 = Color3.fromRGB(40, 40, 40) title.BorderSizePixel = 0 title.TextColor3 = Color3.fromRGB(255, 255, 255) title.TextScaled = true title.Font = Enum.Font.GothamBold title.Text = "ESP [L=Toggle] [O=Hide]" title.Parent = hudFrame local titleCorner = Instance.new("UICorner") titleCorner.CornerRadius = UDim.new(0, 8) titleCorner.Parent = title local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, 0, 0, 25) statusLabel.Position = UDim2.new(0, 0, 0, 38) statusLabel.BackgroundTransparency = 1 statusLabel.TextColor3 = Color3.fromRGB(255, 80, 80) statusLabel.TextScaled = true statusLabel.Font = Enum.Font.Gotham statusLabel.Text = "Status: OFF" statusLabel.Parent = hudFrame local scrollFrame = Instance.new("ScrollingFrame") scrollFrame.Size = UDim2.new(1, -10, 1, -75) scrollFrame.Position = UDim2.new(0, 5, 0, 70) scrollFrame.BackgroundTransparency = 1 scrollFrame.BorderSizePixel = 0 scrollFrame.ScrollBarThickness = 4 scrollFrame.Parent = hudFrame local listLayout = Instance.new("UIListLayout") listLayout.Padding = UDim.new(0, 5) listLayout.Parent = scrollFrame local colorOptions = { { name = "Red", color = Color3.fromRGB(255, 80, 80) }, { name = "Green", color = Color3.fromRGB(80, 255, 80) }, { name = "Blue", color = Color3.fromRGB(80, 150, 255) }, { name = "Yellow", color = Color3.fromRGB(255, 230, 50) }, { name = "White", color = Color3.fromRGB(255, 255, 255)}, } -- ============================================ -- DRAGGING -- ============================================ local function updateDrag(input) local delta = input.Position - dragStart hudFrame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end title.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = hudFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) title.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if dragging and input == dragInput then updateDrag(input) end end) -- ============================================ -- ESP LOGIC -- ============================================ local function applyBox(player) if player == localPlayer then return end local character = player.Character if not character then return end local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then return end if espObjects[player] and espObjects[player].box then espObjects[player].box:Destroy() end if espObjects[player] and espObjects[player].boxLoop then espObjects[player].boxLoop:Disconnect() end local color = playerColors[player] or DEFAULT_COLOR local billboard = Instance.new("BillboardGui") billboard.Adornee = hrp billboard.AlwaysOnTop = true billboard.Size = UDim2.new(0, 50, 0, 90) billboard.StudsOffset = Vector3.new(0, 1, 0) billboard.Parent = hrp local container = Instance.new("Frame") container.Size = UDim2.new(1, 0, 1, 0) container.BackgroundTransparency = 1 container.BorderSizePixel = 0 container.Parent = billboard local thickness = 2 local top = Instance.new("Frame") top.Size = UDim2.new(1, 0, 0, thickness) top.Position = UDim2.new(0, 0, 0, 0) top.BackgroundColor3 = color top.BorderSizePixel = 0 top.Parent = container local bottom = Instance.new("Frame") bottom.Size = UDim2.new(1, 0, 0, thickness) bottom.Position = UDim2.new(0, 0, 1, -thickness) bottom.BackgroundColor3 = color bottom.BorderSizePixel = 0 bottom.Parent = container local left = Instance.new("Frame") left.Size = UDim2.new(0, thickness, 1, 0) left.Position = UDim2.new(0, 0, 0, 0) left.BackgroundColor3 = color left.BorderSizePixel = 0 left.Parent = container local right = Instance.new("Frame") right.Size = UDim2.new(0, thickness, 1, 0) right.Position = UDim2.new(1, -thickness, 0, 0) right.BackgroundColor3 = color right.BorderSizePixel = 0 right.Parent = container if espObjects[player] then espObjects[player].box = billboard else espObjects[player] = { box = billboard } end local loop = RunService.RenderStepped:Connect(function() if not espEnabled then return end if not billboard or not billboard.Parent then return end local localChar = localPlayer.Character if not localChar then return end local localHRP = localChar:FindFirstChild("HumanoidRootPart") if not localHRP then return end if not hrp or not hrp.Parent then return end local camera = workspace.CurrentCamera if not camera then return end local distance = (hrp.Position - camera.CFrame.Position).Magnitude local _, onScreen = camera:WorldToScreenPoint(hrp.Position) if not onScreen then return end local fov = math.rad(camera.FieldOfView) local screenHeight = camera.ViewportSize.Y local pixelsPerStud = screenHeight / (2 * distance * math.tan(fov / 2)) local pixelW = 4.0 * pixelsPerStud local pixelH = 6.0 * pixelsPerStud billboard.Size = UDim2.new(0, pixelW, 0, pixelH) billboard.StudsOffset = Vector3.new(0, 0, 0) end) espObjects[player].boxLoop = loop end local function applyBillboard(player) if player == localPlayer then return end local character = player.Character if not character then return end local head = character:FindFirstChild("Head") if not head then return end if espObjects[player] and espObjects[player].billboard then espObjects[player].billboard:Destroy() end local color = playerColors[player] or DEFAULT_COLOR local billboard = Instance.new("BillboardGui") billboard.Adornee = head billboard.AlwaysOnTop = true billboard.Size = UDim2.new(0, 120, 0, 30) billboard.StudsOffset = Vector3.new(0, 3, 0) billboard.Parent = head local nameLabel = Instance.new("TextLabel") nameLabel.Size = UDim2.new(1, 0, 1, 0) nameLabel.BackgroundTransparency = 1 nameLabel.TextColor3 = color nameLabel.TextScaled = true nameLabel.Font = Enum.Font.GothamBold nameLabel.Text = player.Name nameLabel.TextStrokeTransparency = 0 nameLabel.Parent = billboard if espObjects[player] then espObjects[player].billboard = billboard else espObjects[player] = { billboard = billboard } end applyBox(player) end local function removeESP(player) if espObjects[player] then if espObjects[player].billboard then espObjects[player].billboard:Destroy() end if espObjects[player].box then espObjects[player].box:Destroy() end if espObjects[player].boxLoop then espObjects[player].boxLoop:Disconnect() end espObjects[player] = nil end end -- ============================================ -- HUD PLAYER LIST -- ============================================ local function buildPlayerList() for _, child in ipairs(scrollFrame:GetChildren()) do if child:IsA("Frame") then child:Destroy() end end local players = Players:GetPlayers() scrollFrame.CanvasSize = UDim2.new(0, 0, 0, #players * 70) for _, player in ipairs(players) do if player == localPlayer then continue end local row = Instance.new("Frame") row.Size = UDim2.new(1, 0, 0, 65) row.BackgroundColor3 = Color3.fromRGB(35, 35, 35) row.BorderSizePixel = 0 row.Parent = scrollFrame local rowCorner = Instance.new("UICorner") rowCorner.CornerRadius = UDim.new(0, 6) rowCorner.Parent = row local pName = Instance.new("TextLabel") pName.Size = UDim2.new(1, -10, 0, 20) pName.Position = UDim2.new(0, 5, 0, 4) pName.BackgroundTransparency = 1 pName.TextColor3 = playerColors[player] or DEFAULT_COLOR pName.TextScaled = true pName.Font = Enum.Font.GothamBold pName.Text = player.Name pName.TextXAlignment = Enum.TextXAlignment.Left pName.Parent = row local colorRow = Instance.new("Frame") colorRow.Size = UDim2.new(1, -10, 0, 28) colorRow.Position = UDim2.new(0, 5, 0, 30) colorRow.BackgroundTransparency = 1 colorRow.Parent = row local colorListLayout = Instance.new("UIListLayout") colorListLayout.FillDirection = Enum.FillDirection.Horizontal colorListLayout.Padding = UDim.new(0, 4) colorListLayout.Parent = colorRow for _, option in ipairs(colorOptions) do local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, 32, 1, 0) btn.BackgroundColor3 = option.color btn.BorderSizePixel = 0 btn.Text = "" btn.Parent = colorRow local btnCorner = Instance.new("UICorner") btnCorner.CornerRadius = UDim.new(0, 4) btnCorner.Parent = btn local tip = Instance.new("TextLabel") tip.Size = UDim2.new(1, 0, 0, 12) tip.Position = UDim2.new(0, 0, 1, 2) tip.BackgroundTransparency = 1 tip.TextColor3 = Color3.fromRGB(180, 180, 180) tip.TextScaled = true tip.Font = Enum.Font.Gotham tip.Text = option.name tip.Parent = btn local capturedPlayer = player local capturedColor = option.color btn.MouseButton1Click:Connect(function() playerColors[capturedPlayer] = capturedColor pName.TextColor3 = capturedColor if espEnabled and espObjects[capturedPlayer] then applyBillboard(capturedPlayer) end end) end end end -- ============================================ -- TOGGLE / DESTROY / HIDE -- ============================================ local function toggleESP() espEnabled = not espEnabled if espEnabled then statusLabel.Text = "Status: ON" statusLabel.TextColor3 = Color3.fromRGB(80, 255, 80) for _, player in ipairs(Players:GetPlayers()) do if player ~= localPlayer then applyBillboard(player) end end else statusLabel.Text = "Status: OFF" statusLabel.TextColor3 = Color3.fromRGB(255, 80, 80) for _, player in ipairs(Players:GetPlayers()) do removeESP(player) end end end local function toggleHUD() hudVisible = not hudVisible hudFrame.Visible = hudVisible end local function destroyESP() for _, player in ipairs(Players:GetPlayers()) do removeESP(player) end screenGui:Destroy() end -- ============================================ -- KEYBINDS — CHAT AWARE -- ============================================ UserInputService.InputBegan:Connect(function(input, _gameProcessed) if UserInputService:GetFocusedTextBox() then return end if input.KeyCode == Enum.KeyCode.L then toggleESP() elseif input.KeyCode == Enum.KeyCode.O then toggleHUD() elseif input.KeyCode == Enum.KeyCode.Minus then destroyESP() end end) -- ============================================ -- PLAYER EVENTS -- ============================================ Players.PlayerAdded:Connect(function(player) buildPlayerList() player.CharacterAdded:Connect(function() if espEnabled then task.wait(0.5) applyBillboard(player) end end) end) Players.PlayerRemoving:Connect(function(player) removeESP(player) playerColors[player] = nil buildPlayerList() end) -- Init buildPlayerList()