-- Full ESP Script with Draggable Square GUI + Toggle Button local plr = game.Players.LocalPlayer local cam = workspace.CurrentCamera -- GUI Setup local gui = Instance.new("ScreenGui", plr:WaitForChild("PlayerGui")) gui.Name = "ESP_GUI" gui.ResetOnSpawn = false -- Square Box GUI local box = Instance.new("Frame", gui) box.Name = "DraggableBox" box.Size = UDim2.new(0, 200, 0, 200) box.Position = UDim2.new(0.4, 0, 0.3, 0) box.BackgroundColor3 = Color3.fromRGB(40, 40, 40) box.BorderSizePixel = 2 box.BorderColor3 = Color3.fromRGB(0, 255, 0) box.Active = true box.Draggable = true -- Title local title = Instance.new("TextLabel", box) title.Size = UDim2.new(1, 0, 0, 30) title.Position = UDim2.new(0, 0, 0, 0) title.BackgroundTransparency = 1 title.Text = "🎯 ESP Toggle" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.SourceSansBold title.TextSize = 18 -- Toggle Button local toggle = Instance.new("TextButton", box) toggle.Size = UDim2.new(0.8, 0, 0, 35) toggle.Position = UDim2.new(0.1, 0, 0.5, 0) toggle.Text = "ESP: OFF" toggle.BackgroundColor3 = Color3.fromRGB(70, 70, 70) toggle.TextColor3 = Color3.new(1, 1, 1) toggle.Font = Enum.Font.SourceSansBold toggle.TextSize = 16 -- ESP Logic local espEnabled = false local espObjects = {} local function clearESP() for _, esp in pairs(espObjects) do for _, obj in pairs(esp) do if obj and obj.Remove then obj:Remove() end end end espObjects = {} end local function createESP(p) if p == plr then return end local box = Drawing.new("Square") box.Thickness = 1 box.Color = Color3.fromRGB(0, 255, 0) box.Filled = false box.Transparency = 1 box.Visible = false local name = Drawing.new("Text") name.Size = 14 name.Center = true name.Outline = true name.Color = Color3.fromRGB(0, 255, 255) name.Visible = false local health = Drawing.new("Text") health.Size = 13 health.Center = true health.Outline = true health.Color = Color3.fromRGB(0, 255, 0) health.Visible = false local distance = Drawing.new("Text") distance.Size = 13 distance.Center = true distance.Outline = true distance.Color = Color3.fromRGB(255, 255, 0) distance.Visible = false espObjects[p] = {Box = box, Name = name, Health = health, Distance = distance} end -- Player Add for _, p in pairs(game.Players:GetPlayers()) do createESP(p) end game.Players.PlayerAdded:Connect(createESP) -- Render Loop game:GetService("RunService").RenderStepped:Connect(function() if not espEnabled then clearESP() return end for _, p in pairs(game.Players:GetPlayers()) do if p ~= plr and p.Character and p.Character:FindFirstChild("HumanoidRootPart") and p.Character:FindFirstChild("Humanoid") and p.Character:FindFirstChild("Head") then local root = p.Character.HumanoidRootPart local head = p.Character.Head local hum = p.Character:FindFirstChildOfClass("Humanoid") local esp = espObjects[p] if not esp then createESP(p) esp = espObjects[p] end local pos, visible = cam:WorldToViewportPoint(root.Position) if visible then local dist = (plr.Character.HumanoidRootPart.Position - root.Position).Magnitude local scale = math.clamp(3000 / dist, 50, 300) local width = scale / 2 local height = scale -- Box esp.Box.Size = Vector2.new(width, height) esp.Box.Position = Vector2.new(pos.X - width / 2, pos.Y - height / 1.5) esp.Box.Visible = true -- Name esp.Name.Position = Vector2.new(pos.X, pos.Y - height / 1.5 - 15) esp.Name.Text = p.Name esp.Name.Visible = true -- Health esp.Health.Position = Vector2.new(pos.X, pos.Y - height / 1.5) esp.Health.Text = "HP: " .. math.floor(hum.Health) esp.Health.Visible = true -- Distance esp.Distance.Position = Vector2.new(pos.X, pos.Y + height / 2 + 5) esp.Distance.Text = "Dist: " .. math.floor(dist) esp.Distance.Visible = true else for _, v in pairs(esp) do v.Visible = false end end end end end) -- Toggle ESP toggle.MouseButton1Click:Connect(function() espEnabled = not espEnabled toggle.Text = espEnabled and "ESP: ON" or "ESP: OFF" if not espEnabled then clearESP() end end)