Universal esp
Key RequiredUniversal

Universal esp

Universal Scriptleodmleodm 269 views 15.2K executesUpdated Jul 28, 2026
Unrated
00
Lua Script•523 lines (15946 chars)
loadstring([[
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local CoreGui = game:GetService("CoreGui")
local Camera = workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer

-- =====================
-- VARIABLES
-- =====================
local ESPEnabled = true
local RainbowEnabled = false
local TracersEnabled = true
local BoxEnabled = true
local NameEnabled = true
local DistanceEnabled = true
local HealthEnabled = true
local HeadDotEnabled = true
local TeamCheck = false
local MaxDistance = 1000

local FillColor = Color3.fromRGB(255, 50, 50)
local OutlineColor = Color3.fromRGB(200, 0, 0)
local FillTransparency = 0.5

local highlights = {}
local drawings = {}
local tracers = {}
local rainbowHue = 0
local menuRainbowHue = 0

-- =====================
-- UI
-- =====================
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "UniversalESP"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
pcall(function() ScreenGui.Parent = CoreGui end)
if not ScreenGui.Parent then
	ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
end

-- Bouton flottant
local OpenBtn = Instance.new("TextButton")
OpenBtn.Size = UDim2.new(0, 44, 0, 44)
OpenBtn.Position = UDim2.new(1, -58, 0.5, -22)
OpenBtn.BackgroundColor3 = Color3.fromRGB(25, 25, 40)
OpenBtn.Text = "ESP"
OpenBtn.Font = Enum.Font.GothamBold
OpenBtn.TextSize = 12
OpenBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
OpenBtn.Parent = ScreenGui
Instance.new("UICorner", OpenBtn).CornerRadius = UDim.new(1, 0)
local os = Instance.new("UIStroke", OpenBtn)
os.Color = Color3.fromRGB(80, 80, 140)
os.Thickness = 1.5

-- Menu (plus large + moins haut)
local Main = Instance.new("Frame")
Main.Size = UDim2.new(0, 300, 0, 340)
Main.Position = UDim2.new(0.5, -150, 0.5, -170)
Main.BackgroundColor3 = Color3.fromRGB(14, 14, 20)
Main.BorderSizePixel = 0
Main.Visible = true
Main.Active = true
Main.Parent = ScreenGui
Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 10)

local MainStroke = Instance.new("UIStroke")
MainStroke.Thickness = 2
MainStroke.Parent = Main

-- Title
local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, 0, 0, 32)
Title.BackgroundColor3 = Color3.fromRGB(22, 22, 34)
Title.BorderSizePixel = 0
Title.Text = "  Universal ESP"
Title.Font = Enum.Font.GothamBold
Title.TextSize = 14
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextXAlignment = Enum.TextXAlignment.Left
Title.Parent = Main
Instance.new("UICorner", Title).CornerRadius = UDim.new(0, 10)
local tf = Instance.new("Frame", Title)
tf.Size = UDim2.new(1, 0, 0, 10)
tf.Position = UDim2.new(0, 0, 1, -10)
tf.BackgroundColor3 = Color3.fromRGB(22, 22, 34)
tf.BorderSizePixel = 0

local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 28, 0, 28)
CloseBtn.Position = UDim2.new(1, -30, 0, 2)
CloseBtn.BackgroundTransparency = 1
CloseBtn.Text = "×"
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.TextSize = 18
CloseBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
CloseBtn.Parent = Title

-- Helpers UI
local function Section(text, y)
	local lbl = Instance.new("TextLabel")
	lbl.Size = UDim2.new(1, -16, 0, 16)
	lbl.Position = UDim2.new(0, 8, 0, y)
	lbl.BackgroundTransparency = 1
	lbl.Text = text
	lbl.Font = Enum.Font.GothamBold
	lbl.TextSize = 11
	lbl.TextColor3 = Color3.fromRGB(140, 140, 170)
	lbl.TextXAlignment = Enum.TextXAlignment.Left
	lbl.Parent = Main
	return y + 18
end

local function CreateBtn(text, x, y, w, defaultOn)
	local btn = Instance.new("TextButton")
	btn.Size = UDim2.new(0, w, 0, 26)
	btn.Position = UDim2.new(0, x, 0, y)
	btn.BackgroundColor3 = defaultOn and Color3.fromRGB(28, 105, 48) or Color3.fromRGB(115, 32, 38)
	btn.Text = text
	btn.Font = Enum.Font.GothamMedium
	btn.TextSize = 11
	btn.TextColor3 = Color3.fromRGB(235, 235, 235)
	btn.AutoButtonColor = false
	btn.Parent = Main
	Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 5)
	return btn
end

-- ===== MAIN =====
local y = 38
y = Section("MAIN", y)
local ESPBtn     = CreateBtn("ESP : ON", 8, y, 138, true)
local RainbowBtn = CreateBtn("Rainbow : OFF", 154, y, 138, false)
y = y + 30
local TracerBtn  = CreateBtn("Lignes : ON", 8, y, 138, true)
local TeamBtn    = CreateBtn("Team Check : OFF", 154, y, 138, false)
y = y + 34

-- ===== VISUELS =====
y = Section("VISUELS", y)
local BoxBtn     = CreateBtn("Box : ON", 8, y, 90, true)
local NameBtn    = CreateBtn("Noms : ON", 104, y, 90, true)
local DistBtn    = CreateBtn("Dist : ON", 200, y, 92, true)
y = y + 30
local HealthBtn  = CreateBtn("Vie : ON", 8, y, 90, true)
local HeadBtn    = CreateBtn("Head Dot : ON", 104, y, 188, true)
y = y + 34

-- ===== FILTRES =====
y = Section("FILTRES", y)
local DistMaxBtn = CreateBtn("Max Distance : 1000", 8, y, 284, true)
y = y + 34

-- ===== COULEURS =====
y = Section("COULEURS", y)

local colors = {
	Color3.fromRGB(255, 50, 50), Color3.fromRGB(50, 120, 255),
	Color3.fromRGB(50, 220, 100), Color3.fromRGB(255, 150, 0),
	Color3.fromRGB(180, 60, 255), Color3.fromRGB(255, 80, 180),
	Color3.fromRGB(0, 220, 255), Color3.fromRGB(255, 255, 255),
}

for i, color in ipairs(colors) do
	local btn = Instance.new("TextButton")
	btn.Size = UDim2.new(0, 28, 0, 22)
	btn.Position = UDim2.new(0, 8 + (i-1)*36, 0, y)
	btn.BackgroundColor3 = color
	btn.Text = ""
	btn.Parent = Main
	Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 4)
	local s = Instance.new("UIStroke", btn)
	s.Color = Color3.fromRGB(60, 60, 85)
	s.Thickness = 1
	btn.MouseButton1Click:Connect(function()
		FillColor = color
		OutlineColor = color:Lerp(Color3.new(0,0,0), 0.28)
	end)
end
y = y + 28

local TransBtn = CreateBtn("Transparence : 50%", 8, y, 284, true)

-- =====================
-- LOGIQUE BOUTONS
-- =====================
local function setBtn(btn, state, onText, offText)
	btn.Text = state and onText or offText
	btn.BackgroundColor3 = state and Color3.fromRGB(28, 105, 48) or Color3.fromRGB(115, 32, 38)
end

ESPBtn.MouseButton1Click:Connect(function()
	ESPEnabled = not ESPEnabled
	setBtn(ESPBtn, ESPEnabled, "ESP : ON", "ESP : OFF")
end)

RainbowBtn.MouseButton1Click:Connect(function()
	RainbowEnabled = not RainbowEnabled
	setBtn(RainbowBtn, RainbowEnabled, "Rainbow : ON", "Rainbow : OFF")
end)

TracerBtn.MouseButton1Click:Connect(function()
	TracersEnabled = not TracersEnabled
	setBtn(TracerBtn, TracersEnabled, "Lignes : ON", "Lignes : OFF")
end)

TeamBtn.MouseButton1Click:Connect(function()
	TeamCheck = not TeamCheck
	setBtn(TeamBtn, TeamCheck, "Team Check : ON", "Team Check : OFF")
end)

BoxBtn.MouseButton1Click:Connect(function()
	BoxEnabled = not BoxEnabled
	setBtn(BoxBtn, BoxEnabled, "Box : ON", "Box : OFF")
end)

NameBtn.MouseButton1Click:Connect(function()
	NameEnabled = not NameEnabled
	setBtn(NameBtn, NameEnabled, "Noms : ON", "Noms : OFF")
end)

DistBtn.MouseButton1Click:Connect(function()
	DistanceEnabled = not DistanceEnabled
	setBtn(DistBtn, DistanceEnabled, "Dist : ON", "Dist : OFF")
end)

HealthBtn.MouseButton1Click:Connect(function()
	HealthEnabled = not HealthEnabled
	setBtn(HealthBtn, HealthEnabled, "Vie : ON", "Vie : OFF")
end)

HeadBtn.MouseButton1Click:Connect(function()
	HeadDotEnabled = not HeadDotEnabled
	setBtn(HeadBtn, HeadDotEnabled, "Head Dot : ON", "Head Dot : OFF")
end)

DistMaxBtn.MouseButton1Click:Connect(function()
	if MaxDistance == 500 then MaxDistance = 1000
	elseif MaxDistance == 1000 then MaxDistance = 2000
	elseif MaxDistance == 2000 then MaxDistance = 5000
	else MaxDistance = 500 end
	DistMaxBtn.Text = "Max Distance : " .. MaxDistance
end)

TransBtn.MouseButton1Click:Connect(function()
	FillTransparency += 0.15
	if FillTransparency > 0.85 then FillTransparency = 0.2 end
	TransBtn.Text = "Transparence : " .. math.floor(FillTransparency * 100) .. "%"
end)

CloseBtn.MouseButton1Click:Connect(function() Main.Visible = false end)
OpenBtn.MouseButton1Click:Connect(function() Main.Visible = not Main.Visible end)

UserInputService.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.KeyCode == Enum.KeyCode.RightShift then
		Main.Visible = not Main.Visible
	end
end)

-- Drag
local dragging, dragStart, startPos
Title.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		dragging = true
		dragStart = input.Position
		startPos = Main.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
		Main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
	end
end)

-- =====================
-- ESP CORE
-- =====================
local function getColor(player)
	if RainbowEnabled then
		return Color3.fromHSV(rainbowHue, 1, 1)
	end
	if player.Team and player.Team.TeamColor then
		return player.Team.TeamColor.Color
	end
	return FillColor
end

local function isValid(player)
	if not ESPEnabled then return false end
	if TeamCheck and player.Team and LocalPlayer.Team and player.Team == LocalPlayer.Team then
		return false
	end
	return true
end

local function createHighlight(char)
	if not char then return end
	if highlights[char] and highlights[char].Parent then return highlights[char] end
	local hl = Instance.new("Highlight")
	hl.Name = "UESP"
	hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
	hl.FillTransparency = FillTransparency
	hl.OutlineTransparency = 0
	hl.Parent = char
	highlights[char] = hl
	return hl
end

local function removeHighlight(char)
	if highlights[char] then
		highlights[char]:Destroy()
		highlights[char] = nil
	end
end

local function createDrawings(player)
	if drawings[player] then return drawings[player] end
	local t = {}
	local function safe(type)
		local ok, obj = pcall(function() return Drawing.new(type) end)
		return ok and obj or nil
	end

	t.box = safe("Square")
	if t.box then t.box.Thickness = 1 t.box.Filled = false t.box.Visible = false end

	t.name = safe("Text")
	if t.name then t.name.Size = 13 t.name.Center = true t.name.Outline = true t.name.Visible = false end

	t.dist = safe("Text")
	if t.dist then t.dist.Size = 12 t.dist.Center = true t.dist.Outline = true t.dist.Visible = false end

	t.healthBar = safe("Line")
	if t.healthBar then t.healthBar.Thickness = 3 t.healthBar.Visible = false end

	t.headDot = safe("Circle")
	if t.headDot then
		t.headDot.Thickness = 1 t.headDot.Filled = true
		t.headDot.NumSides = 12 t.headDot.Radius = 3 t.headDot.Visible = false
	end

	drawings[player] = t
	return t
end

local function removeDrawings(player)
	if drawings[player] then
		for _, obj in pairs(drawings[player]) do
			if obj then pcall(function() obj:Remove() end) end
		end
		drawings[player] = nil
	end
end

local function createTracer(player)
	if tracers[player] then return tracers[player] end
	local ok, line = pcall(function() return Drawing.new("Line") end)
	if ok and line then
		line.Thickness = 1.3
		line.Transparency = 0.85
		line.Visible = false
		tracers[player] = line
		return line
	end
end

local function removeTracer(player)
	if tracers[player] then
		tracers[player]:Remove()
		tracers[player] = nil
	end
end

local function onCharacter(player, char)
	if player == LocalPlayer then return end
	task.wait(0.3)
	createHighlight(char)
	createDrawings(player)
	createTracer(player)
	char.AncestryChanged:Connect(function(_, parent)
		if not parent then removeHighlight(char) end
	end)
end

local function onPlayer(player)
	if player == LocalPlayer then return end
	player.CharacterAdded:Connect(function(char) onCharacter(player, char) end)
	if player.Character then onCharacter(player, player.Character) end
end

for _, p in ipairs(Players:GetPlayers()) do onPlayer(p) end
Players.PlayerAdded:Connect(onPlayer)
Players.PlayerRemoving:Connect(function(p)
	if p.Character then removeHighlight(p.Character) end
	removeDrawings(p)
	removeTracer(p)
end)

-- =====================
-- BOUCLE
-- =====================
RunService.RenderStepped:Connect(function()
	menuRainbowHue = (menuRainbowHue + 0.008) % 1
	MainStroke.Color = Color3.fromHSV(menuRainbowHue, 1, 1)
	rainbowHue = (rainbowHue + 0.004) % 1

	local screenSize = Camera.ViewportSize
	local fromPos = Vector2.new(screenSize.X / 2, screenSize.Y)

	for _, player in ipairs(Players:GetPlayers()) do
		if player == LocalPlayer then continue end

		local char = player.Character
		local root = char and char:FindFirstChild("HumanoidRootPart")
		local head = char and char:FindFirstChild("Head")
		local humanoid = char and char:FindFirstChildOfClass("Humanoid")
		local hl = char and highlights[char]
		local d = drawings[player]
		local line = tracers[player]

		local valid = isValid(player) and root
		local distance = valid and (root.Position - Camera.CFrame.Position).Magnitude or 9999
		local tooFar = distance > MaxDistance
		local pos, onScreen = Vector3.zero, false
		if root then
			pos, onScreen = Camera:WorldToViewportPoint(root.Position)
		end

		-- Highlight
		if valid and not tooFar then
			if not hl or not hl.Parent then hl = createHighlight(char) end
			if hl then
				hl.Enabled = true
				hl.FillTransparency = FillTransparency
				local c = getColor(player)
				hl.FillColor = c
				hl.OutlineColor = c:Lerp(Color3.new(0,0,0), 0.3)
			end
		elseif hl then
			hl.Enabled = false
		end

		-- Drawings
		if d then
			-- Box
			if d.box then
				if valid and not tooFar and onScreen and BoxEnabled then
					local size = 1800 / distance
					d.box.Size = Vector2.new(size * 1.35, size * 2.1)
					d.box.Position = Vector2.new(pos.X - d.box.Size.X/2, pos.Y - d.box.Size.Y/2)
					d.box.Color = getColor(player)
					d.box.Visible = true
				else d.box.Visible = false end
			end

			-- Name
			if d.name then
				if valid and not tooFar and onScreen and NameEnabled then
					d.name.Text = player.Name
					d.name.Position = Vector2.new(pos.X, pos.Y - (d.box and d.box.Size.Y/2 or 35) - 12)
					d.name.Color = getColor(player)
					d.name.Visible = true
				else d.name.Visible = false end
			end

			-- Distance
			if d.dist then
				if valid and not tooFar and onScreen and DistanceEnabled then
					d.dist.Text = math.floor(distance) .. "m"
					d.dist.Position = Vector2.new(pos.X, pos.Y + (d.box and d.box.Size.Y/2 or 25) + 4)
					d.dist.Color = Color3.fromRGB(220, 220, 220)
					d.dist.Visible = true
				else d.dist.Visible = false end
			end

			-- Health
			if d.healthBar and humanoid then
				if valid and not tooFar and onScreen and HealthEnabled then
					local hp = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1)
					local h = (d.box and d.box.Size.Y or 45) * hp
					local bx = pos.X - (d.box and d.box.Size.X/2 or 22) - 5
					local by = pos.Y + (d.box and d.box.Size.Y/2 or 22)
					d.healthBar.From = Vector2.new(bx, by)
					d.healthBar.To = Vector2.new(bx, by - h)
					d.healthBar.Color = Color3.fromRGB(255*(1-hp), 255*hp, 40)
					d.healthBar.Visible = true
				else d.healthBar.Visible = false end
			end

			-- Head Dot
			if d.headDot then
				local headPos = head and Camera:WorldToViewportPoint(head.Position + Vector3.new(0,0.4,0))
				if valid and not tooFar and headPos and HeadDotEnabled then
					d.headDot.Position = Vector2.new(headPos.X, headPos.Y)
					d.headDot.Color = getColor(player)
					d.headDot.Visible = true
				else d.headDot.Visible = false end
			end
		end

		-- Tracer
		if line then
			if valid and not tooFar and TracersEnabled and onScreen then
				line.From = fromPos
				line.To = Vector2.new(pos.X, pos.Y)
				line.Color = getColor(player)
				line.Visible = true
			else line.Visible = false end
		end
	end
end)

print("Universal ESP Pro (Mobile Optimized) chargé")
]])()

Features & Information

Best Esp script

Community Comments (1)

MercyyMercyySep 20, 2026

detectable

More Scripts for Universal Scripts