loadstring([[ -- Services local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- Constants local GUI_WIDTH, GUI_HEIGHT = 220, 170 local TITLE_HEIGHT = 30 local ESP_BOX_ON_COLOR = Color3.fromRGB(0, 150, 0) local ESP_BOX_OFF_COLOR = Color3.fromRGB(150, 0, 0) local HEALTH_BAR_GOOD_COLOR = Color3.new(0, 1, 0) local HEALTH_BAR_BAD_COLOR = Color3.new(1, 0, 0) -- Create ScreenGui local screenGui = Instance.new("ScreenGui") screenGui.Name = "ESPGui" screenGui.ResetOnSpawn = false -- Parent ScreenGui safely (CoreGui preferred) local success = pcall(function() screenGui.Parent = game:GetService("CoreGui") end) if not success then screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") end -- Main Frame local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, GUI_WIDTH, 0, GUI_HEIGHT) mainFrame.Position = UDim2.new(0.5, -GUI_WIDTH/2, 0.1, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) mainFrame.BorderSizePixel = 0 mainFrame.Parent = screenGui mainFrame.Active = true mainFrame.Draggable = true -- Title Label local title = Instance.new("TextLabel") title.Text = "ESP Settings" title.Size = UDim2.new(1, -60, 0, TITLE_HEIGHT) title.BackgroundColor3 = Color3.fromRGB(40, 40, 40) title.TextColor3 = Color3.new(1,1,1) title.Font = Enum.Font.SourceSansBold title.TextSize = 18 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = mainFrame -- Close Button (X) local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, TITLE_HEIGHT, 0, TITLE_HEIGHT) closeButton.Position = UDim2.new(1, -TITLE_HEIGHT, 0, 0) closeButton.BackgroundColor3 = Color3.fromRGB(150, 0, 0) closeButton.TextColor3 = Color3.new(1,1,1) closeButton.Font = Enum.Font.SourceSansBold closeButton.TextSize = 20 closeButton.Text = "X" closeButton.Parent = mainFrame -- Minimize Button (-) local minimizeButton = Instance.new("TextButton") minimizeButton.Size = UDim2.new(0, TITLE_HEIGHT, 0, TITLE_HEIGHT) minimizeButton.Position = UDim2.new(1, -TITLE_HEIGHT*2, 0, 0) minimizeButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100) minimizeButton.TextColor3 = Color3.new(1,1,1) minimizeButton.Font = Enum.Font.SourceSansBold minimizeButton.TextSize = 20 minimizeButton.Text = "-" minimizeButton.Parent = mainFrame -- Helper to create toggle buttons local function createToggleButton(text, position) local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, 200, 0, 40) btn.Position = position btn.BackgroundColor3 = ESP_BOX_OFF_COLOR btn.TextColor3 = Color3.new(1,1,1) btn.Font = Enum.Font.SourceSansBold btn.TextSize = 18 btn.Text = text..": OFF" btn.Parent = mainFrame return btn end local boxButton = createToggleButton("Box ESP", UDim2.new(0, 10, 0, 40)) local healthButton = createToggleButton("Health Bar ESP", UDim2.new(0, 10, 0, 85)) local nameButton = createToggleButton("Name ESP", UDim2.new(0, 10, 0, 130)) local boxEnabled, healthEnabled, nameEnabled = false, false, false local function updateButton(btn, enabled) local baseText = btn.Text:match("^(.-):") btn.Text = baseText .. (enabled and ": ON" or ": OFF") btn.BackgroundColor3 = enabled and ESP_BOX_ON_COLOR or ESP_BOX_OFF_COLOR end -- ESP Drawing objects container local espObjects = {} local function createESP() local box = Drawing.new("Square") box.Visible = false box.Color = Color3.new(1,1,1) box.Thickness = 2 box.Filled = false local healthBar = Drawing.new("Square") healthBar.Visible = false healthBar.Color = Color3.new(0,1,0) healthBar.Thickness = 1 healthBar.Filled = true local nameText = Drawing.new("Text") nameText.Visible = false nameText.Center = true nameText.Color = Color3.new(1,1,1) nameText.Outline = true nameText.OutlineColor = Color3.new(0,0,0) nameText.Size = 18 nameText.Font = 2 return {box = box, healthBar = healthBar, nameText = nameText} end local function addPlayerESP(player) if player ~= LocalPlayer and not espObjects[player] then espObjects[player] = createESP() espObjects[player].box.Visible = boxEnabled espObjects[player].healthBar.Visible = healthEnabled espObjects[player].nameText.Visible = nameEnabled end end local function removePlayerESP(player) if espObjects[player] then espObjects[player].box:Remove() espObjects[player].healthBar:Remove() espObjects[player].nameText:Remove() espObjects[player] = nil end end -- Initialize existing players for _, player in pairs(Players:GetPlayers()) do addPlayerESP(player) end Players.PlayerAdded:Connect(addPlayerESP) Players.PlayerRemoving:Connect(removePlayerESP) -- Toggle button events boxButton.MouseButton1Click:Connect(function() boxEnabled = not boxEnabled updateButton(boxButton, boxEnabled) for _, esp in pairs(espObjects) do esp.box.Visible = boxEnabled end end) healthButton.MouseButton1Click:Connect(function() healthEnabled = not healthEnabled updateButton(healthButton, healthEnabled) for _, esp in pairs(espObjects) do esp.healthBar.Visible = healthEnabled end end) nameButton.MouseButton1Click:Connect(function() nameEnabled = not nameEnabled updateButton(nameButton, nameEnabled) for _, esp in pairs(espObjects) do esp.nameText.Visible = nameEnabled end end) minimizeButton.MouseButton1Click:Connect(function() if mainFrame.Size.Y.Offset > TITLE_HEIGHT then mainFrame.Size = UDim2.new(0, GUI_WIDTH, 0, TITLE_HEIGHT) boxButton.Visible = false healthButton.Visible = false nameButton.Visible = false else mainFrame.Size = UDim2.new(0, GUI_WIDTH, 0, GUI_HEIGHT) boxButton.Visible = true healthButton.Visible = true nameButton.Visible = true end end) closeButton.MouseButton1Click:Connect(function() screenGui:Destroy() for _, esp in pairs(espObjects) do esp.box:Remove() esp.healthBar:Remove() esp.nameText:Remove() end end) -- Main update loop RunService.RenderStepped:Connect(function() for player, esp in pairs(espObjects) do if player.Team == LocalPlayer.Team then esp.box.Visible = false esp.healthBar.Visible = false esp.nameText.Visible = false continue end local character = player.Character local humanoid = character and character:FindFirstChildOfClass("Humanoid") local hrp = character and character:FindFirstChild("HumanoidRootPart") if humanoid and hrp and humanoid.Health > 0 then local screenPos, onScreen = Camera:WorldToViewportPoint(hrp.Position) if onScreen then local bottomPos, _ = Camera:WorldToViewportPoint(hrp.Position - Vector3.new(0, 3, 0)) local boxHeight = math.abs(screenPos.Y - bottomPos.Y) local boxWidth = boxHeight / 2 -- Box ESP if boxEnabled then esp.box.Visible = true esp.box.Size = Vector2.new(boxWidth, boxHeight) esp.box.Position = Vector2.new(screenPos.X - boxWidth/2, screenPos.Y - boxHeight/2) esp.box.Color = ESP_BOX_ON_COLOR else esp.box.Visible = false end -- Health Bar ESP if healthEnabled then local healthPercent = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1) esp.healthBar.Visible = true esp.healthBar.Size = Vector2.new(5, boxHeight * healthPercent) esp.healthBar.Position = Vector2.new(screenPos.X - boxWidth/2 - 10, screenPos.Y + boxHeight/2 - esp.healthBar.Size.Y) esp.healthBar.Color = Color3.new(1 - healthPercent, healthPercent, 0) else esp.healthBar.Visible = false end -- Name ESP if nameEnabled then esp.nameText.Visible = true esp.nameText.Text = player.Name esp.nameText.Position = Vector2.new(screenPos.X, screenPos.Y - boxHeight/2 - 20) else esp.nameText.Visible = false end else esp.box.Visible = false esp.healthBar.Visible = false esp.nameText.Visible = false end else esp.box.Visible = false esp.healthBar.Visible = false esp.nameText.Visible = false end end end) ]])()