local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local RunService = game:GetService("RunService") local ESPenabled = false local Player_Boxes = {} local ScreenGui = Instance.new("ScreenGui") ScreenGui.Parent = gethui() ScreenGui.Name = "ScreenGuiTest" local Frame = Instance.new("Frame") Frame.Parent = ScreenGui Frame.Size = UDim2.new(0, 100, 0, 50) Frame.Position = UDim2.new(0.763, 0, 0.848, 0) Frame.BackgroundColor3 = Color3.new(1, 1, 1) Frame.BackgroundTransparency = 0.5 local UIcorner = Instance.new("UICorner") UIcorner.Parent = Frame UIcorner.CornerRadius = UDim.new(0, 10) local TextButton = Instance.new("TextButton") TextButton.Parent = Frame TextButton.Size = UDim2.new(0, 100, 0, 50) TextButton.Text = "ESP OFF" TextButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) TextButton.TextScaled = true local UIcorner2 = Instance.new("UICorner") UIcorner2.Parent = TextButton UIcorner2.CornerRadius = UDim.new(0, 10) local UIStroke = Instance.new("UIStroke") UIStroke.Parent = TextButton UIStroke.Thickness = 2 UIStroke.Color = Color3.new(0, 0, 0) local function PlayerBox(player) if player == LocalPlayer then return end local box = Drawing.new("Square") box.Color = Color3.fromRGB(255, 0, 255) box.Thickness = 2 box.Filled = false box.Visible = false local name = Drawing.new("Text") name.Color = Color3.fromRGB(255, 255, 255) name.Size = 16 name.Center = true name.Outline = true name.Visible = false local health = Drawing.new("Square") health.Color = Color3.fromRGB(0, 255, 0) health.Filled = true health.Visible = false Player_Boxes[player] = { Box = box, Name = name, Health = health } end for _, player in pairs(Players:GetPlayers()) do PlayerBox(player) end Players.PlayerAdded:Connect(function(player) PlayerBox(player) end) Players.PlayerRemoving:Connect(function(player) if Player_Boxes[player] then Player_Boxes[player].Box:Remove() Player_Boxes[player].Name:Remove() Player_Boxes[player].Health:Remove() Player_Boxes[player] = nil end end) TextButton.MouseButton1Click:Connect(function() ESPenabled = not ESPenabled if ESPenabled then TextButton.Text = "ESP ON" TextButton.BackgroundColor3 = Color3.fromRGB(0,255,0) else TextButton.Text = "ESP OFF" TextButton.BackgroundColor3 = Color3.fromRGB(255,0,0) for _, data in pairs(Player_Boxes) do data.Box.Visible = false data.Name.Visible = false data.Health.Visible = false end end end) RunService.RenderStepped:Connect(function() if not ESPenabled then return end local camera = workspace.CurrentCamera for player, data in pairs(Player_Boxes) do local character = player.Character if character then local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then local cf, size = character:GetBoundingBox() local top = cf.Position + Vector3.new(0, size.Y/2, 0) local bottom = cf.Position - Vector3.new(0, size.Y/2, 0) local topScreen, topVisible = camera:WorldToViewportPoint(top) local bottomScreen, bottomVisible = camera:WorldToViewportPoint(bottom) if topVisible and bottomVisible then local height = math.abs(bottomScreen.Y - topScreen.Y) local width = height * 0.5 data.Box.Size = Vector2.new( width, height ) data.Box.Position = Vector2.new( topScreen.X - width/2, topScreen.Y ) data.Box.Visible = true data.Name.Text = player.Name data.Name.Position = Vector2.new( topScreen.X, topScreen.Y - 20 ) data.Name.Visible = true local healthPercent = humanoid.Health / humanoid.MaxHealth local healthHeight = height * healthPercent data.Health.Size = Vector2.new( 5, healthHeight ) data.Health.Position = Vector2.new( topScreen.X - width/2 - 10, bottomScreen.Y - healthHeight ) data.Health.Visible = true else data.Box.Visible = false data.Name.Visible = false data.Health.Visible = false end end else data.Box.Visible = false data.Name.Visible = false data.Health.Visible = false end end end)