local sg = Instance.new("ScreenGui") sg.Name = "ESPControl" sg.ResetOnSpawn = false sg.Parent = game:GetService("CoreGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 200, 0, 80) frame.Position = UDim2.new(0.5, -100, 0.1, 0) frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) frame.BorderSizePixel = 0 frame.Parent = sg local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 20) title.BackgroundTransparency = 1 title.Text = "ESP Control" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.SourceSansBold title.TextSize = 14 title.Parent = frame local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(1, -20, 0, 25) toggleBtn.Position = UDim2.new(0, 10, 0, 25) toggleBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40) toggleBtn.Text = "ESP: OFF" toggleBtn.TextColor3 = Color3.fromRGB(255, 50, 50) toggleBtn.Font = Enum.Font.SourceSansBold toggleBtn.TextSize = 14 toggleBtn.Parent = frame local rangeLabel = Instance.new("TextLabel") rangeLabel.Size = UDim2.new(0.6, 0, 0, 20) rangeLabel.Position = UDim2.new(0, 10, 0, 55) rangeLabel.BackgroundTransparency = 1 rangeLabel.Text = "Range: 500" rangeLabel.TextColor3 = Color3.fromRGB(200, 200, 200) rangeLabel.Font = Enum.Font.SourceSans rangeLabel.TextSize = 13 rangeLabel.Parent = frame local dragging local dragStart local startPos frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = frame.Position end end) frame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) game:GetService("UserInputService").InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then local delta = input.Position - dragStart frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) local espEnabled = false local highlights = {} local maxRange = 500 local lastUpdate = 0 local updateInterval = 0.3 local localPlayer = game:GetService("Players").LocalPlayer local camera = workspace.CurrentCamera local function createHighlight(model) if highlights[model] then return end local highlight = Instance.new("Highlight") highlight.FillColor = Color3.fromRGB(255, 0, 255) highlight.OutlineColor = Color3.fromRGB(255, 255, 255) highlight.FillTransparency = 0.6 highlight.OutlineTransparency = 0 highlight.Adornee = model highlight.Parent = model highlights[model] = highlight end local function removeHighlight(model) if highlights[model] then highlights[model]:Destroy() highlights[model] = nil end end local function isPlayerModel(obj) if not obj or not obj:IsA("Model") then return false end return obj:FindFirstChildWhichIsA("Humanoid") ~= nil end local function getDistance(model) if not model or not model.PrimaryPart then return 999999 end local root = model.PrimaryPart or model:FindFirstChild("HumanoidRootPart") or model:FindFirstChildWhichIsA("BasePart") if not root then return 999999 end return (camera.CFrame.Position - root.Position).Magnitude end local function updateESP() if tick() - lastUpdate < updateInterval then return end lastUpdate = tick() local toKeep = {} for _, obj in ipairs(workspace:GetDescendants()) do if isPlayerModel(obj) then local dist = getDistance(obj) if espEnabled and dist <= maxRange then createHighlight(obj) toKeep[obj] = true else removeHighlight(obj) end end end for _, v in ipairs(getnilinstances()) do if isPlayerModel(v) then local dist = getDistance(v) if espEnabled and dist <= maxRange then createHighlight(v) toKeep[v] = true else removeHighlight(v) end end end for model in pairs(highlights) do if not toKeep[model] then removeHighlight(model) end end end toggleBtn.MouseButton1Click:Connect(function() espEnabled = not espEnabled if espEnabled then toggleBtn.Text = "ESP: ON" toggleBtn.TextColor3 = Color3.fromRGB(0, 255, 100) else toggleBtn.Text = "ESP: OFF" toggleBtn.TextColor3 = Color3.fromRGB(255, 50, 50) end updateESP() end) game:GetService("RunService").Heartbeat:Connect(updateESP)