--[[ ESP Script for Roblox (with settings menu) ------------------------------------------ Drop into StarterPlayerScripts as a LocalScript, or run with an executor. Press RightShift (or click the "ESP" button) to open/close the menu. NOTE: Only use this in games you own or on private servers. ]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") -- ============================================================ -- CONFIG -- ============================================================ local Config = { Enabled = true, ShowHighlight = true, ShowName = true, ShowHealthBar = true, ShowDistance = true, TeamCheck = false, IgnoreSelf = true, MaxDistance = 500, FillColor = Color3.fromRGB(255, 60, 60), OutlineColor = Color3.fromRGB(255, 255, 255), FillTransparency = 0.7, OutlineTransparency = 0, MenuKey = Enum.KeyCode.RightShift, } local ACCENT = Color3.fromRGB(90, 140, 255) local ACCENT2 = Color3.fromRGB(165, 95, 255) local DARK = Color3.fromRGB(28, 30, 36) local DARKER = Color3.fromRGB(18, 19, 24) local TEXT = Color3.fromRGB(235, 235, 240) local ROW_HOVER = Color3.fromRGB(38, 41, 52) local function makeGradient(parent, c1, c2, rotation) local g = Instance.new("UIGradient") g.Color = ColorSequence.new(c1, c2) g.Rotation = rotation or 0 g.Parent = parent return g end -- ============================================================ -- ESP CORE -- ============================================================ local ESP = {} local Connections = {} local function isAlive(player) local char = player.Character if not char then return false end local humanoid = char:FindFirstChildOfClass("Humanoid") local root = char:FindFirstChild("HumanoidRootPart") return humanoid ~= nil and root ~= nil and humanoid.Health > 0 end local function shouldShow(player) if not Config.Enabled then return false end if Config.IgnoreSelf and player == LocalPlayer then return false end if Config.TeamCheck and LocalPlayer.Team and player.Team == LocalPlayer.Team then return false end return isAlive(player) end local function makeHighlight() local h = Instance.new("Highlight") h.Name = "ESP_Highlight" h.FillColor = Config.FillColor h.OutlineColor = Config.OutlineColor h.FillTransparency = Config.FillTransparency h.OutlineTransparency = Config.OutlineTransparency h.Enabled = false return h end local function applyColors() for _, data in pairs(ESP) do if data.Highlight and data.Highlight.Parent then data.Highlight.FillColor = Config.FillColor data.Highlight.OutlineColor = Config.OutlineColor data.Highlight.FillTransparency = Config.FillTransparency data.Highlight.OutlineTransparency = Config.OutlineTransparency end end end local function createLabel(parent, name, text, size, position, color) local label = Instance.new("TextLabel") label.Name = name label.Text = text label.Size = size label.Position = position label.BackgroundTransparency = 1 label.TextColor3 = color or Color3.new(1, 1, 1) label.TextStrokeColor3 = Color3.new(0, 0, 0) label.TextStrokeTransparency = 0.3 label.TextScaled = true label.Font = Enum.Font.GothamBold label.Parent = parent return label end local function createESP(player) if ESP[player] then return end local gui = Instance.new("BillboardGui") gui.Name = "ESP_" .. player.Name gui.AlwaysOnTop = true gui.Size = UDim2.new(0, 170, 0, 70) gui.StudsOffset = Vector3.new(0, 2.5, 0) gui.MaxDistance = Config.MaxDistance gui.Enabled = false gui.Parent = PlayerGui local nameLabel = createLabel(gui, "Name", player.Name, UDim2.new(1, 0, 0, 20), UDim2.new(0, 0, 0, 0), Color3.fromRGB(255, 255, 255)) local distLabel = createLabel(gui, "Distance", "", UDim2.new(1, 0, 0, 16), UDim2.new(0, 0, 0.22, 0), Color3.fromRGB(190, 220, 255)) local barBg = Instance.new("Frame") barBg.Name = "HealthBarBg" barBg.Size = UDim2.new(0.9, 0, 0, 10) barBg.Position = UDim2.new(0.05, 0, 0.46, 0) barBg.BackgroundColor3 = Color3.fromRGB(25, 25, 25) barBg.BorderSizePixel = 1 barBg.BorderColor3 = Color3.new(0, 0, 0) barBg.Parent = gui local barFill = Instance.new("Frame") barFill.Name = "HealthBarFill" barFill.Size = UDim2.new(1, 0, 1, 0) barFill.BackgroundColor3 = Color3.fromRGB(60, 255, 90) barFill.BorderSizePixel = 0 barFill.Parent = barBg ESP[player] = { Gui = gui, NameLabel = nameLabel, DistLabel = distLabel, BarBg = barBg, BarFill = barFill, Highlight = nil, -- created per character in attachToCharacter } end local function attachToCharacter(player) local data = ESP[player] if not data then return end local char = player.Character if not char then return end data.Gui.Adornee = char:FindFirstChild("HumanoidRootPart") -- The previous Highlight is destroyed along with the old character, -- so always recreate it and parent it to the new one. if data.Highlight then data.Highlight:Destroy() end local highlight = makeHighlight() highlight.Parent = char data.Highlight = highlight end local function setupPlayer(player) createESP(player) attachToCharacter(player) Connections[player] = {} table.insert(Connections[player], player.CharacterAdded:Connect(function() task.wait(0.1) attachToCharacter(player) end)) end local function removeESP(player) local data = ESP[player] if data then data.Gui:Destroy() if data.Highlight then data.Highlight:Destroy() end ESP[player] = nil end if Connections[player] then for _, conn in ipairs(Connections[player]) do conn:Disconnect() end Connections[player] = nil end end for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer then setupPlayer(player) end end Players.PlayerAdded:Connect(setupPlayer) Players.PlayerRemoving:Connect(removeESP) -- ============================================================ -- MENU UI -- ============================================================ local function new(class, props, parent) local inst = Instance.new(class) for k, v in pairs(props) do inst[k] = v end inst.Parent = parent return inst end local menuGui = new("ScreenGui", { Name = "ESP_Menu", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 999, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, }, PlayerGui) -- Floating open/close button (draggable, starts top-left) local toggleBtn = new("TextButton", { Text = "", Size = UDim2.new(0, 46, 0, 46), Position = UDim2.new(0, 12, 0, 12), BackgroundColor3 = ACCENT, AutoButtonColor = false, Parent = menuGui, }, menuGui) new("UICorner", { CornerRadius = UDim.new(0, 13) }, toggleBtn) makeGradient(toggleBtn, ACCENT, ACCENT2, 45) new("UIStroke", { Color = Color3.fromRGB(255, 255, 255), Transparency = 0.55, Thickness = 1.5 }, toggleBtn) new("TextLabel", { Text = "ESP", Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, TextColor3 = Color3.new(1, 1, 1), Font = Enum.Font.GothamBold, TextSize = 16, TextStrokeTransparency = 0.6, ZIndex = 2, Parent = toggleBtn, }, toggleBtn) toggleBtn.MouseEnter:Connect(function() TweenService:Create(toggleBtn, TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Size = UDim2.new(0, 50, 0, 50), }):Play() end) toggleBtn.MouseLeave:Connect(function() TweenService:Create(toggleBtn, TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Size = UDim2.new(0, 46, 0, 46), }):Play() end) -- Main window local window = new("Frame", { Name = "Window", Size = UDim2.new(0, 280, 0, 440), Position = UDim2.new(0, 12, 0, 68), BackgroundColor3 = DARK, BorderSizePixel = 0, Visible = false, Parent = menuGui, }, menuGui) new("UICorner", { CornerRadius = UDim.new(0, 14) }, window) makeGradient(window, Color3.fromRGB(35, 38, 48), Color3.fromRGB(19, 20, 26), 90) local windowStroke = new("UIStroke", { Color = ACCENT, Transparency = 0.3, Thickness = 1.5 }, window) makeGradient(windowStroke, ACCENT, ACCENT2, 45) local uiScale = new("UIScale", { Scale = 1 }, window) local titleBar = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundColor3 = DARKER, BorderSizePixel = 0, Parent = window, }, window) new("UICorner", { CornerRadius = UDim.new(0, 14) }, titleBar) makeGradient(titleBar, Color3.fromRGB(64, 104, 214), Color3.fromRGB(138, 78, 226), 0) local titleLabel = new("TextLabel", { Text = "ESP Settings", Size = UDim2.new(1, -60, 1, 0), Position = UDim2.new(0, 14, 0, 0), BackgroundTransparency = 1, TextColor3 = Color3.new(1, 1, 1), TextXAlignment = Enum.TextXAlignment.Left, Font = Enum.Font.GothamBold, TextSize = 16, Parent = titleBar, }, titleBar) makeGradient(titleLabel, Color3.fromRGB(255, 255, 255), Color3.fromRGB(210, 225, 255), 90) local closeBtn = new("TextButton", { Text = "", Size = UDim2.new(0, 30, 0, 30), Position = UDim2.new(1, -38, 0, 4), BackgroundColor3 = Color3.fromRGB(210, 65, 75), AutoButtonColor = false, Parent = titleBar, }, titleBar) new("UICorner", { CornerRadius = UDim.new(0, 8) }, closeBtn) makeGradient(closeBtn, Color3.fromRGB(235, 90, 95), Color3.fromRGB(190, 55, 120), 45) new("TextLabel", { Text = "×", Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, TextColor3 = Color3.new(1, 1, 1), Font = Enum.Font.GothamBold, TextSize = 20, ZIndex = 2, Parent = closeBtn, }, closeBtn) closeBtn.MouseEnter:Connect(function() TweenService:Create(closeBtn, TweenInfo.new(0.12), {BackgroundTransparency = 0.15}):Play() end) closeBtn.MouseLeave:Connect(function() TweenService:Create(closeBtn, TweenInfo.new(0.12), {BackgroundTransparency = 0}):Play() end) -- Scroll area local scroll = new("ScrollingFrame", { Size = UDim2.new(1, -16, 1, -50), Position = UDim2.new(0, 8, 0, 44), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 5, ScrollBarImageColor3 = ACCENT, CanvasSize = UDim2.new(0, 0, 0, 0), AutomaticCanvasSize = Enum.AutomaticSize.Y, Parent = window, }, window) new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder, HorizontalAlignment = Enum.HorizontalAlignment.Center, }, scroll) -- ---------- widget builders ---------- local function makeSection(text, order) local header = new("TextLabel", { Text = text, Size = UDim2.new(1, 0, 0, 24), BackgroundTransparency = 1, TextColor3 = Color3.new(1, 1, 1), TextXAlignment = Enum.TextXAlignment.Left, Font = Enum.Font.GothamBold, TextSize = 13, LayoutOrder = order, Parent = scroll, }, scroll) makeGradient(header, ACCENT, ACCENT2, 0) end local function makeToggle(text, get, set, order) local row = new("TextButton", { Size = UDim2.new(1, 0, 0, 30), BackgroundColor3 = DARKER, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = scroll, }, scroll) new("UICorner", { CornerRadius = UDim.new(0, 8) }, row) new("TextLabel", { Text = text, Size = UDim2.new(1, -46, 1, 0), Position = UDim2.new(0, 10, 0, 0), BackgroundTransparency = 1, TextColor3 = TEXT, TextXAlignment = Enum.TextXAlignment.Left, Font = Enum.Font.Gotham, TextSize = 14, Parent = row, }, row) local box = new("Frame", { Size = UDim2.new(0, 20, 0, 20), Position = UDim2.new(1, -30, 0.5, -10), BackgroundColor3 = DARK, BorderSizePixel = 0, Parent = row, }, row) new("UICorner", { CornerRadius = UDim.new(0, 5) }, box) local boxStroke = new("UIStroke", { Color = Color3.fromRGB(80, 85, 100), Thickness = 1 }, box) local boxGradient = makeGradient(box, ACCENT, ACCENT2, 45) local check = new("TextLabel", { Text = "✓", Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, TextColor3 = Color3.new(1, 1, 1), Font = Enum.Font.GothamBold, TextSize = 15, Visible = get(), Parent = box, }, box) local function refresh() local on = get() check.Visible = on box.BackgroundColor3 = on and ACCENT or DARK boxGradient.Enabled = on boxStroke.Color = on and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(80, 85, 100) end refresh() row.MouseEnter:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), {BackgroundColor3 = ROW_HOVER}):Play() end) row.MouseLeave:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), {BackgroundColor3 = DARKER}):Play() end) row.MouseButton1Click:Connect(function() set(not get()) refresh() end) end local activeSlider = nil local function makeSlider(text, min, max, get, set, order, isInt) local row = new("Frame", { Size = UDim2.new(1, 0, 0, 42), BackgroundColor3 = DARKER, BorderSizePixel = 0, LayoutOrder = order, Parent = scroll, }, scroll) new("UICorner", { CornerRadius = UDim.new(0, 8) }, row) local label = new("TextLabel", { Text = text, Size = UDim2.new(1, -80, 0, 20), Position = UDim2.new(0, 10, 0, 3), BackgroundTransparency = 1, TextColor3 = TEXT, TextXAlignment = Enum.TextXAlignment.Left, Font = Enum.Font.Gotham, TextSize = 13, Parent = row, }, row) local valueLabel = new("TextLabel", { Text = "", Size = UDim2.new(0, 70, 0, 20), Position = UDim2.new(1, -78, 0, 3), BackgroundTransparency = 1, TextColor3 = ACCENT, TextXAlignment = Enum.TextXAlignment.Right, Font = Enum.Font.GothamBold, TextSize = 13, Parent = row, }, row) local track = new("Frame", { Size = UDim2.new(1, -20, 0, 6), Position = UDim2.new(0, 10, 0, 28), BackgroundColor3 = Color3.fromRGB(55, 60, 72), BorderSizePixel = 0, Parent = row, }, row) new("UICorner", { CornerRadius = UDim.new(0, 3) }, track) local fill = new("Frame", { Size = UDim2.new(0, 0, 1, 0), BackgroundColor3 = ACCENT, BorderSizePixel = 0, Parent = track, }, track) new("UICorner", { CornerRadius = UDim.new(0, 3) }, fill) makeGradient(fill, ACCENT, ACCENT2, 0) local function format(v) if isInt then return tostring(math.floor(v + 0.5)) end return string.format("%.2f", v) end local function refresh() local pct = (get() - min) / (max - min) fill.Size = UDim2.new(pct, 0, 1, 0) valueLabel.Text = format(get()) end local function setFromX(x) local pct = math.clamp((x - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1) local v = min + (max - min) * pct if isInt then v = math.floor(v + 0.5) end set(v) refresh() end track.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then activeSlider = setFromX setFromX(input.Position.X) end end) UserInputService.InputChanged:Connect(function(input) if activeSlider == setFromX and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then setFromX(input.Position.X) end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then if activeSlider == setFromX then activeSlider = nil end end end) refresh() end local function makeColorPicker(title, getColor, setColor, order) makeSection(title, order) local preview = new("Frame", { Size = UDim2.new(1, 0, 0, 26), BackgroundColor3 = getColor(), BorderSizePixel = 0, LayoutOrder = order + 1, Parent = scroll, }, scroll) new("UICorner", { CornerRadius = UDim.new(0, 8) }, preview) new("UIStroke", { Color = Color3.fromRGB(80, 85, 100), Thickness = 1 }, preview) local function push() local c = Color3.fromRGB( math.floor(preview:GetAttribute("R") or 255), math.floor(preview:GetAttribute("G") or 255), math.floor(preview:GetAttribute("B") or 255) ) setColor(c) preview.BackgroundColor3 = c end preview:SetAttribute("R", math.floor(getColor().R * 255)) preview:SetAttribute("G", math.floor(getColor().G * 255)) preview:SetAttribute("B", math.floor(getColor().B * 255)) makeSlider("Red", 0, 255, function() return preview:GetAttribute("R") end, function(v) preview:SetAttribute("R", v); push() end, order + 2, true) makeSlider("Green", 0, 255, function() return preview:GetAttribute("G") end, function(v) preview:SetAttribute("G", v); push() end, order + 3, true) makeSlider("Blue", 0, 255, function() return preview:GetAttribute("B") end, function(v) preview:SetAttribute("B", v); push() end, order + 4, true) return order + 5 end -- ---------- populate ---------- local order = 0 local function nextOrder() order = order + 1 return order end makeToggle("Enable ESP", function() return Config.Enabled end, function(v) Config.Enabled = v end, nextOrder()) makeToggle("Show Name", function() return Config.ShowName end, function(v) Config.ShowName = v end, nextOrder()) makeToggle("Show Health Bar", function() return Config.ShowHealthBar end, function(v) Config.ShowHealthBar = v end, nextOrder()) makeToggle("Show Distance", function() return Config.ShowDistance end, function(v) Config.ShowDistance = v end, nextOrder()) makeToggle("Show Highlight", function() return Config.ShowHighlight end, function(v) Config.ShowHighlight = v end, nextOrder()) makeToggle("Team Check", function() return Config.TeamCheck end, function(v) Config.TeamCheck = v end, nextOrder()) local function setFill(c) Config.FillColor = c applyColors() end local function setOutline(c) Config.OutlineColor = c applyColors() end order = makeColorPicker("Highlight Fill Color", function() return Config.FillColor end, setFill, nextOrder()) order = makeColorPicker("Outline Color", function() return Config.OutlineColor end, setOutline, nextOrder()) makeSlider("Fill Transparency", 0, 1, function() return Config.FillTransparency end, function(v) Config.FillTransparency = v; applyColors() end, nextOrder()) makeSlider("Max Distance", 50, 2000, function() return Config.MaxDistance end, function(v) Config.MaxDistance = v for _, data in pairs(ESP) do data.Gui.MaxDistance = v end end, nextOrder(), true) -- ---------- window behavior ---------- local menuOpen = false local menuTween local function setMenuOpen(open) if open == menuOpen then return end menuOpen = open if menuTween then menuTween:Cancel() end if open then window.Visible = true uiScale.Scale = 0.9 menuTween = TweenService:Create(uiScale, TweenInfo.new(0.22, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Scale = 1}) menuTween:Play() else menuTween = TweenService:Create(uiScale, TweenInfo.new(0.14, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Scale = 0.9}) menuTween:Play() menuTween.Completed:Connect(function() if not menuOpen then window.Visible = false end end) end end closeBtn.MouseButton1Click:Connect(function() setMenuOpen(false) end) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Config.MenuKey then setMenuOpen(not menuOpen) end end) -- drag the window by its title bar do local dragging, dragStart, startPos titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = window.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart window.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) end -- drag the floating ESP button (a click without moving opens/closes the menu) do local dragging, dragStart, startPos, moved toggleBtn.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true moved = false dragStart = input.Position startPos = toggleBtn.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false if not moved then setMenuOpen(not menuOpen) end end end) end end) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart if delta.Magnitude > 4 then moved = true end toggleBtn.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) end -- ============================================================ -- RENDER LOOP -- ============================================================ RunService.RenderStepped:Connect(function() local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") for player, data in pairs(ESP) do if not shouldShow(player) then data.Gui.Enabled = false if data.Highlight then data.Highlight.Enabled = false end continue end local char = player.Character local root = char:FindFirstChild("HumanoidRootPart") local humanoid = char:FindFirstChildOfClass("Humanoid") if not root or not humanoid then continue end data.Gui.Enabled = true if data.Highlight then data.Highlight.Enabled = Config.ShowHighlight end data.NameLabel.Visible = Config.ShowName data.NameLabel.Text = player.Name data.DistLabel.Visible = Config.ShowDistance if myRoot and Config.ShowDistance then data.DistLabel.Text = math.floor((myRoot.Position - root.Position).Magnitude) .. " studs" end data.BarBg.Visible = Config.ShowHealthBar if Config.ShowHealthBar then local ratio = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1) data.BarFill.Size = UDim2.new(ratio, 0, 1, 0) data.BarFill.BackgroundColor3 = Color3.fromHSV(ratio * 0.3, 0.8, 1) end end end)