--[[ TEAM ESP · RO-CAM v2.0 Ally = green, enemy = red. Draggable panel, live roster. WHY THIS VERSION EXISTS RO-CAM is a MorphToR6 game (custom R6 morph rigs), so a script that demands HumanoidRootPart + Humanoid can silently draw nothing. This one anchors on any body part, falls back to Frames if the executor's Drawing library is broken, and shows a live status line so you can see whether it is drawing at all. TEAM SOURCES, best first Player.Team, Player/Character attributes, Player.TeamColor, value objects, ReplicatedStorage, character PARENT FOLDER, clothing, body colour, tags, then SPAWN GROUP. Spawn group is the one that saves you in this game: at round start your team spawns together, so everyone within 45 studs of you on spawn is marked ally. In the lobby that collapses to one group and is ignored. CONTROLS Right Shift show / hide panel Click a name cycle auto -> ALLY -> ENEMY Team source cycle every detected field by hand Renderer switch Drawing <-> Frames if nothing draws Mark nearest mark the 5 closest players as ally, right now ]] if getgenv and getgenv().TeamESP then pcall(getgenv().TeamESP.destroy) end local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UIS = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local CollectionService = game:GetService("CollectionService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Teams = game:GetService("Teams") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- ───────────────────────────── config ───────────────────────────── local CONFIG = { keybind = Enum.KeyCode.RightShift, maxDistance = 400, spawnRadius = 45, teamCheck = true, boxes = true, corners = true, names = true, health = true, distance = true, tracers = true, wallCheck = false, teamColors = true, debug = false, teamColor = Color3.fromRGB(64, 232, 148), enemyColor = Color3.fromRGB(255, 76, 106), soloColor = Color3.fromRGB(130, 190, 255), customTeamCheck = nil, } local C = { bg = Color3.fromRGB(11, 13, 18), panel = Color3.fromRGB(19, 22, 30), surface = Color3.fromRGB(30, 35, 46), stroke = Color3.fromRGB(46, 53, 68), text = Color3.fromRGB(232, 237, 248), muted = Color3.fromRGB(120, 130, 150), accent = Color3.fromRGB(124, 92, 255), team = CONFIG.teamColor, enemy = CONFIG.enemyColor, } local BORING = { ["Medium stone grey"] = true, ["Dark stone grey"] = true, ["Light stone grey"] = true, ["Institutional white"] = true, ["White"] = true, ["Really black"] = true, ["Black"] = true, } -- ───────────────────────────── helpers ──────────────────────────── local function new(class, props, parent) local inst = Instance.new(class) for k, v in pairs(props or {}) do inst[k] = v end if parent then inst.Parent = parent end return inst end local function safeParent(inst) local ok = pcall(function() inst.Parent = (gethui and gethui()) or game:GetService("CoreGui") end) if not ok or not inst.Parent then inst.Parent = LocalPlayer:WaitForChild("PlayerGui") end end -- character resolution, tolerant of custom character systems local charFallback = {} local function refreshCharCache() for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer and not (p.Character and p.Character.Parent) then local found for _, d in ipairs(workspace:GetChildren()) do if d:IsA("Model") and d.Name:find(p.Name, 1, true) then found = d break end end charFallback[p] = found else charFallback[p] = nil end end end local function charOf(plr) local ch = plr.Character if ch and ch.Parent then return ch end return charFallback[plr] end local function anchorOf(char) if not char then return nil, nil end local hum = char:FindFirstChildOfClass("Humanoid") local root = char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso") or char:FindFirstChild("Head") if not root then for _, d in ipairs(char:GetDescendants()) do if d:IsA("BasePart") then root = d break end end end return root, hum end -- ───────────────────── team source detection ───────────────────── local ATTR_KEYS = { "Team", "team", "TeamName", "TeamId", "Faction", "faction", "Side", "side", "Role", "role", "Class", "class", "Squad", "squad", "Group", "group", } local TEAMISH = { "team", "faction", "side", "role", "class", "squad", "group", "alliance", "clan", "guild", "color", "colour", } local function norm(v) local t = typeof(v) if t == "Instance" then return v.Name end if t == "BrickColor" then return v.Name end if t == "boolean" then return v and "true" or nil end if t == "string" then return v ~= "" and v or nil end if v == nil or v == false then return nil end return tostring(v) end local function attrSig(inst) for _, k in ipairs(ATTR_KEYS) do local ok, v = pcall(function() return inst:GetAttribute(k) end) if ok then local s = norm(v) if s then return s end end end return nil end local function nameIsTeamish(name) local n = name:lower() for _, w in ipairs(TEAMISH) do if n:find(w, 1, true) then return true end end return false end local function valueScan(inst, depth) local ok, kids = pcall(function() return inst:GetChildren() end) if not ok then return nil end for _, c in ipairs(kids) do if c:IsA("ValueBase") and nameIsTeamish(c.Name) then local ok2, v = pcall(function() return c.Value end) if ok2 then local s = norm(v) if s then return s end end end end if depth > 1 then for _, c in ipairs(kids) do if c:IsA("Folder") or c:IsA("Configuration") then local r = valueScan(c, depth - 1) if r then return r end end end end return nil end local function tagSig(inst) local ok, tags = pcall(function() return CollectionService:GetTags(inst) end) if not ok or #tags == 0 then return nil end table.sort(tags) return table.concat(tags, ",") end local rsIndex = { map = {}, at = 0 } local function buildRSIndex() local now = os.clock() if now - rsIndex.at < 6 then return end rsIndex.at = now local map, seen = {}, 0 pcall(function() for _, c in ipairs(ReplicatedStorage:GetChildren()) do seen += 1 if seen > 900 then return end if c:IsA("ValueBase") then local ok, v = pcall(function() return c.Value end) if ok then map[c.Name] = norm(v) end elseif c:IsA("Folder") or c:IsA("Configuration") or c:IsA("Model") then for _, d in ipairs(c:GetChildren()) do seen += 1 if seen > 900 then return end if d:IsA("ValueBase") then local ok, v = pcall(function() return d.Value end) if ok then map[d.Name] = norm(v) end end end end end end) rsIndex.map = map end -- spawn-group allies: filled on every spawn of the local character local spawnAllies = {} local function snapshotSpawnGroup() task.spawn(function() task.wait(1.2) local myRoot = anchorOf(LocalPlayer.Character) if not myRoot then return end local set, n = {}, 0 for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer then local root = anchorOf(charOf(p)) if root and (root.Position - myRoot.Position).Magnitude <= CONFIG.spawnRadius then set[p.UserId] = true n += 1 end end end if n >= 1 and n <= 8 then spawnAllies = set if getgenv then getgenv().TeamESP_lastSpawnGroup = n end end end) end local SOURCES = { { name = "Player.Team", trust = 6, get = function(p) local t = p.Team return t and t.Name end }, { name = "Player attributes", trust = 5, get = function(p) return attrSig(p) end }, { name = "Character attributes", trust = 5, get = function(p) local ch = charOf(p) return ch and attrSig(ch) or nil end }, { name = "Player.TeamColor", trust = 4, get = function(p) local c = p.TeamColor if not c then return nil end if BORING[c.Name] then return nil end return c.Name end }, { name = "Player values", trust = 4, get = function(p) return valueScan(p, 2) end }, { name = "Character values", trust = 4, get = function(p) local ch = charOf(p) return ch and valueScan(ch, 1) or nil end }, { name = "ReplicatedStorage", trust = 3, get = function(p) buildRSIndex() return rsIndex.map[p.Name] or rsIndex.map[tostring(p.UserId)] end }, { name = "Character parent", trust = 3, get = function(p) local ch = charOf(p) local par = ch and ch.Parent if par and (par:IsA("Folder") or par:IsA("Model") or par:IsA("Configuration")) then return par.Name end return nil end }, { name = "Clothing", trust = 3, get = function(p) local ch = charOf(p) if not ch then return nil end local shirt = ch:FindFirstChildOfClass("Shirt") local pants = ch:FindFirstChildOfClass("Pants") local a, b = "", "" if shirt then local ok, v = pcall(function() return shirt.ShirtTemplate end) if ok and v then a = v end end if pants then local ok, v = pcall(function() return pants.PantsTemplate end) if ok and v then b = v end end if a == "" and b == "" then return nil end return a .. "|" .. b end }, { name = "Spawn group", trust = 2, get = function(p) if p == LocalPlayer then return "me" end return spawnAllies[p.UserId] and "me" or "other" end }, { name = "Body colour", trust = 1, get = function(p) local ch = charOf(p) if not ch then return nil end local bc = ch:FindFirstChildOfClass("BodyColors") if not bc then return nil end local ok, c = pcall(function() return bc.TorsoColor.Name end) if ok and c and not BORING[c] then return c end return nil end }, { name = "Player tags", trust = 1, get = function(p) return tagSig(p) end }, { name = "Character tags", trust = 1, get = function(p) local ch = charOf(p) return ch and tagSig(ch) or nil end }, } local state = { candidates = {}, active = nil, forced = nil, overrides = {} } local function allySetFor(get, myKey) local set, n = {}, 0 for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer then local ok, k = pcall(get, p) if ok and k == myKey then set[p] = true n += 1 end end end return set, n end local function analyze() local players = Players:GetPlayers() local mine = LocalPlayer local out = {} for _, s in ipairs(SOURCES) do local map, count = {}, 0 for _, p in ipairs(players) do local ok, k = pcall(s.get, p) if ok and k ~= nil and k ~= "" then map[p] = k count += 1 end end local myKey = map[mine] if myKey ~= nil and count >= 2 then local groups, distinct = {}, 0 for p, k in pairs(map) do if groups[k] == nil then groups[k] = {} distinct += 1 end table.insert(groups[k], p) end local same = math.max(#(groups[myKey] or {}) - 1, 0) local others = math.max(count - 1, 0) local valid = distinct >= 2 and same >= 1 local score = 0 if valid then score = 10 + math.min(distinct, 6) * 2 + math.min(same, 5) + ((others > same) and 3 or 0) + (s.trust or 0) if distinct == 2 then local sizes = {} for _, g in pairs(groups) do table.insert(sizes, #g) end table.sort(sizes) if math.abs(sizes[1] - sizes[2]) <= 1 then score += 6 end end end table.insert(out, { name = s.name, get = s.get, key = myKey, same = same, others = others, distinct = distinct, valid = valid, score = score, group = tostring(myKey), }) end end local function sortOut() table.sort(out, function(a, b) if a.valid ~= b.valid then return a.valid end return a.score > b.score end) end sortOut() local top = out[1] if top and top.valid then local ref, refN = allySetFor(top.get, top.key) if refN > 0 then for i = 2, math.min(#out, 6) do local c = out[i] if c.valid then local set, n = allySetFor(c.get, c.key) local inter = 0 for p in pairs(set) do if ref[p] then inter += 1 end end if inter / math.max(refN + n - inter, 1) >= 0.6 then c.score += 4 end end end sortOut() end end state.candidates = out end local function resolveActive() state.active = nil local cands = state.candidates if #cands == 0 then return end if state.forced then for _, c in ipairs(cands) do if c.name == state.forced then state.active = c return end end end state.active = cands[1] end local function isAlly(plr) local o = state.overrides[plr.UserId] if o then return o == "ally" end if CONFIG.customTeamCheck then local ok, r = pcall(CONFIG.customTeamCheck, plr, LocalPlayer) if ok and r ~= nil then return r == true end end local a = state.active if not a then return false end local ok, k = pcall(a.get, plr) return ok and k == a.key end local function allyColor(plr) if CONFIG.teamColors then local ok, tc = pcall(function() return plr.TeamColor end) if ok and tc and not BORING[tc.Name] then return tc.Color end end return CONFIG.teamColor end local function report() local lines = { ("TEAM ESP v2.0 report universe=%s place=%s"):format(tostring(game.GameId), tostring(game.PlaceId)), ("players: %d renderer: %s"):format(#Players:GetPlayers(), Backend and Backend.name or "none"), ("teams service children: %d"):format(#Teams:GetChildren()), ("spawn group size: %d"):format(#(function() local n = 0 for _ in pairs(spawnAllies) do n += 1 end return {n} end)()), ("active source: %s"):format(state.active and state.active.name or "none"), ("local: %s (%d)"):format(LocalPlayer.Name, LocalPlayer.UserId), "", } for _, c in ipairs(state.candidates) do table.insert(lines, ("cand %-22s group=%-18s same=%d others=%d distinct=%d valid=%s score=%d"):format( c.name, c.group, c.same, c.others, c.distinct, tostring(c.valid), c.score)) end table.insert(lines, "") for _, p in ipairs(Players:GetPlayers()) do local parts = {} for _, s in ipairs(SOURCES) do local ok, v = pcall(s.get, p) if ok and v then table.insert(parts, s.name .. "=" .. tostring(v)) end end local root = anchorOf(charOf(p)) table.insert(lines, ("%s (%d) char=%s root=%s | %s"):format( p.Name, p.UserId, charOf(p) and charOf(p).ClassName or "nil", root and root.Name or "nil", #parts > 0 and table.concat(parts, " ; ") or "no team data")) end return table.concat(lines, "\n") end -- ───────────────────────────── backends ────────────────────────── local function drawingBackend() if not Drawing then return nil end local function mk(class) local ok, o = pcall(Drawing.new, class) if ok and o then return o end return nil end if not mk("Square") then return nil end return { name = "Drawing", newBox = function() local o = mk("Square") if not o then return nil end return { apply = function(p) o.Position = Vector2.new(p.x, p.y) o.Size = Vector2.new(p.w, p.h) o.Color = p.color o.Visible = p.visible ~= false o.Thickness = p.thickness or 1 o.Filled = p.filled == true o.Transparency = p.filled and 0.2 or 0.4 end, hide = function() o.Visible = false end, remove = function() pcall(function() o:Remove() end) end, } end, newLine = function() local o = mk("Line") if not o then return nil end return { apply = function(p) o.From = Vector2.new(p.x1, p.y1) o.To = Vector2.new(p.x2, p.y2) o.Color = p.color o.Visible = p.visible ~= false o.Thickness = p.thickness or 1 o.Transparency = p.alpha or 0.4 end, hide = function() o.Visible = false end, remove = function() pcall(function() o:Remove() end) end, } end, newText = function(size) local o = mk("Text") if not o then return nil end pcall(function() o.Size = size o.Center = true o.Outline = true o.OutlineColor = Color3.new(0, 0, 0) end) return { apply = function(p) o.Position = Vector2.new(p.cx, p.cy) o.Text = p.text o.Color = p.color o.Visible = p.visible ~= false end, hide = function() o.Visible = false end, remove = function() pcall(function() o:Remove() end) end, } end, } end local function framesBackend() local sg = Instance.new("ScreenGui") sg.Name = "TeamESP_Draw" sg.ResetOnSpawn = false sg.DisplayOrder = 999 pcall(function() sg.ScreenInsets = Enum.ScreenInsets.None end) safeParent(sg) return { name = "Frames", gui = sg, newBox = function() local f = new("Frame", { BackgroundTransparency = 1, BorderSizePixel = 0 }, sg) local stroke = new("UIStroke", { ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Thickness = 1 }, f) return { apply = function(p) f.Position = UDim2.fromOffset(p.x, p.y) f.Size = UDim2.fromOffset(math.max(p.w, 1), math.max(p.h, 1)) f.Visible = p.visible ~= false if p.filled then f.BackgroundColor3 = p.color f.BackgroundTransparency = 0.2 stroke.Transparency = 1 else f.BackgroundTransparency = 1 stroke.Color = p.color stroke.Thickness = p.thickness or 1 stroke.Transparency = 0.4 end end, hide = function() f.Visible = false end, remove = function() f:Destroy() end, } end, newLine = function() local f = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = Color3.new(1, 1, 1), BorderSizePixel = 0, }, sg) return { apply = function(p) local dx, dy = p.x2 - p.x1, p.y2 - p.y1 local len = math.sqrt(dx * dx + dy * dy) f.Position = UDim2.fromOffset((p.x1 + p.x2) * 0.5, (p.y1 + p.y2) * 0.5) f.Size = UDim2.fromOffset(math.max(len, 1), p.thickness or 1) f.Rotation = math.deg(math.atan2(dy, dx)) f.BackgroundColor3 = p.color f.BackgroundTransparency = p.alpha or 0.4 f.Visible = p.visible ~= false end, hide = function() f.Visible = false end, remove = function() f:Destroy() end, } end, newText = function(size) local t = new("TextLabel", { AnchorPoint = Vector2.new(0.5, 0.5), Size = UDim2.fromOffset(260, size + 8), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = size, TextStrokeTransparency = 0.35, TextColor3 = Color3.new(1, 1, 1), }, sg) return { apply = function(p) t.Position = UDim2.fromOffset(p.cx, p.cy) t.Text = p.text t.TextColor3 = p.color t.Visible = p.visible ~= false end, hide = function() t.Visible = false end, remove = function() t:Destroy() end, } end, } end local Backend = nil local cache = {} local conns = {} local function destroyESP(e) for _, p in ipairs(e.parts) do pcall(p.remove) end e.parts = {} end local function hideESP(e) for _, p in ipairs(e.parts) do pcall(p.hide) end end local function makeESP() if not Backend then return nil end local e = { parts = {} } local function add(p) if p then table.insert(e.parts, p) end return p end e.box = add(Backend.newBox()) e.corner = {} for i = 1, 8 do e.corner[i] = add(Backend.newLine()) end e.tag = add(Backend.newText(11)) e.name = add(Backend.newText(14)) e.dist = add(Backend.newText(12)) e.hpBg = add(Backend.newBox()) e.hp = add(Backend.newBox()) e.tracer = add(Backend.newLine()) if not e.box then return nil end return e end local function clearESPs() for _, e in pairs(cache) do destroyESP(e) end cache = {} end local function buildBackend(mode) local b if mode == "drawing" then b = drawingBackend() elseif mode == "frames" then b = framesBackend() else b = drawingBackend() or framesBackend() end return b end local function setRenderer(mode) if Backend and Backend.gui then pcall(function() Backend.gui:Destroy() end) end clearESPs() Backend = buildBackend(mode) for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer then local e = makeESP() if e then cache[p] = e end end end if refreshRoster then refreshRoster() end end -- ───────────────────────────── gui ─────────────────────────────── local gui = Instance.new("ScreenGui") gui.Name = "TeamESP_UI" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.DisplayOrder = 1000 pcall(function() gui.ScreenInsets = Enum.ScreenInsets.CoreUISafeInsets end) safeParent(gui) local panel = new("Frame", { Name = "Panel", Size = UDim2.fromOffset(312, 0), AutomaticSize = Enum.AutomaticSize.Y, Position = UDim2.fromOffset(32, 32), BackgroundColor3 = Color3.new(1, 1, 1), BorderSizePixel = 0, Active = true, }, gui) new("UICorner", { CornerRadius = UDim.new(0, 12) }, panel) new("UIStroke", { Color = C.stroke, Thickness = 1, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }, panel) new("UIGradient", { Rotation = 90, Color = ColorSequence.new(C.panel, C.bg) }, panel) new("UIListLayout", { SortOrder = Enum.SortOrder.LayoutOrder }, panel) local header = new("Frame", { Size = UDim2.new(1, 0, 0, 60), BackgroundTransparency = 1, LayoutOrder = 1, }, panel) local dot = new("Frame", { Size = UDim2.fromOffset(8, 8), Position = UDim2.fromOffset(16, 24), BackgroundColor3 = C.accent, BorderSizePixel = 0, }, header) new("UICorner", { CornerRadius = UDim.new(1, 0) }, dot) new("TextLabel", { Size = UDim2.new(1, -70, 0, 18), Position = UDim2.fromOffset(32, 12), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = 15, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left, Text = "TEAM ESP · RO-CAM", }, header) local subtitle = new("TextLabel", { Size = UDim2.new(1, -70, 0, 14), Position = UDim2.fromOffset(32, 32), BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 11, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, Text = "starting...", }, header) local diag = new("TextLabel", { Size = UDim2.new(1, -70, 0, 12), Position = UDim2.fromOffset(32, 46), BackgroundTransparency = 1, Font = Enum.Font.Code, TextSize = 10, TextColor3 = C.accent, TextXAlignment = Enum.TextXAlignment.Left, Text = "", }, header) local function divider(order) local wrap = new("Frame", { Size = UDim2.new(1, 0, 0, 1), BackgroundTransparency = 1, LayoutOrder = order, }, panel) new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14) }, wrap) new("Frame", { Size = UDim2.new(1, 0, 1, 0), BackgroundColor3 = C.stroke, BackgroundTransparency = 0.25, BorderSizePixel = 0, }, wrap) end local refreshRoster local function styleButton(b) new("UICorner", { CornerRadius = UDim.new(0, 7) }, b) new("UIStroke", { Color = C.stroke, Thickness = 1, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }, b) b.MouseEnter:Connect(function() TweenService:Create(b, TweenInfo.new(0.12), { BackgroundTransparency = 0.1 }):Play() end) b.MouseLeave:Connect(function() TweenService:Create(b, TweenInfo.new(0.12), { BackgroundTransparency = 0.35 }):Play() end) end local sourceWrap = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, LayoutOrder = 2, }, panel) new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 4), PaddingBottom = UDim.new(0, 4), }, sourceWrap) local sourceBtn = new("TextButton", { Size = UDim2.new(1, 0, 1, 0), BackgroundColor3 = C.surface, BackgroundTransparency = 0.35, BorderSizePixel = 0, AutoButtonColor = false, Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left, Text = " Team source: auto", }, sourceWrap) styleButton(sourceBtn) divider(3) local btnRows = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 4, }, panel) new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 4), }, btnRows) new("UIListLayout", { SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, 6) }, btnRows) local function buttonRow(order) local r = new("Frame", { Size = UDim2.new(1, 0, 0, 30), BackgroundTransparency = 1, LayoutOrder = order, }, btnRows) new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, 6), }, r) return r end local function smallButton(parent, order, label, onClick) local b = new("TextButton", { Size = UDim2.new(0.5, -3, 1, 0), BackgroundColor3 = C.surface, BackgroundTransparency = 0.35, BorderSizePixel = 0, AutoButtonColor = false, Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = C.text, Text = label, LayoutOrder = order, }, parent) styleButton(b) b.MouseButton1Click:Connect(onClick) return b end local row1 = buttonRow(1) local row2 = buttonRow(2) smallButton(row1, 1, "Rescan", function() analyze(); resolveActive(); refreshRoster() end) smallButton(row1, 2, "Copy report", function() local text = report() if setclipboard then pcall(setclipboard, text) end if writefile then pcall(writefile, "team_esp_report.txt", text) end warn(text) end) local rendererBtn = smallButton(row2, 1, "Renderer: auto", function() end) local markBtn = smallButton(row2, 2, "Mark nearest", function() end) markBtn.MouseButton1Click:Connect(function() local myRoot = anchorOf(LocalPlayer.Character) if not myRoot then return end local scored = {} for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer then local root = anchorOf(charOf(p)) if root then table.insert(scored, { p = p, d = (root.Position - myRoot.Position).Magnitude }) end end end table.sort(scored, function(a, b) return a.d < b.d end) for i = 1, math.min(5, #scored) do state.overrides[scored[i].p.UserId] = "ally" end refreshRoster() end) divider(5) local toggleList = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 6, }, panel) new("UIPadding", { PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 8), PaddingLeft = UDim.new(0, 8), PaddingRight = UDim.new(0, 8), }, toggleList) new("UIListLayout", { SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, 2) }, toggleList) local function makeToggle(order, label, key) local row = new("TextButton", { Size = UDim2.new(1, 0, 0, 30), BackgroundColor3 = C.surface, BackgroundTransparency = 1, BorderSizePixel = 0, AutoButtonColor = false, Text = "", LayoutOrder = order, }, toggleList) new("UICorner", { CornerRadius = UDim.new(0, 7) }, row) new("TextLabel", { Size = UDim2.new(1, -70, 1, 0), Position = UDim2.fromOffset(9, 0), BackgroundTransparency = 1, Font = Enum.Font.GothamMedium, TextSize = 13, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left, Text = label, }, row) local pill = new("Frame", { Size = UDim2.fromOffset(34, 18), Position = UDim2.new(1, -43, 0.5, -9), BackgroundColor3 = C.stroke, BorderSizePixel = 0, }, row) new("UICorner", { CornerRadius = UDim.new(1, 0) }, pill) local knob = new("Frame", { Size = UDim2.fromOffset(12, 12), Position = UDim2.fromOffset(3, 3), BackgroundColor3 = C.muted, BorderSizePixel = 0, }, pill) new("UICorner", { CornerRadius = UDim.new(1, 0) }, knob) local function paint(on, instant) local info = TweenInfo.new(instant and 0 or 0.16, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) TweenService:Create(pill, info, { BackgroundColor3 = on and C.accent or C.stroke }):Play() TweenService:Create(knob, info, { Position = UDim2.fromOffset(on and 19 or 3, 3), BackgroundColor3 = on and C.text or C.muted, }):Play() end paint(CONFIG[key], true) row.MouseEnter:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), { BackgroundTransparency = 0.55 }):Play() end) row.MouseLeave:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), { BackgroundTransparency = 1 }):Play() end) row.MouseButton1Click:Connect(function() CONFIG[key] = not CONFIG[key] paint(CONFIG[key], false) if key == "teamCheck" or key == "teamColors" then refreshRoster() end end) end makeToggle(1, "Team check", "teamCheck") makeToggle(2, "Boxes", "boxes") makeToggle(3, "Corner brackets", "corners") makeToggle(4, "Names", "names") makeToggle(5, "Health bars", "health") makeToggle(6, "Distance", "distance") makeToggle(7, "Tracers", "tracers") makeToggle(8, "Game team colours", "teamColors") divider(7) local rosterHead = new("Frame", { Size = UDim2.new(1, 0, 0, 24), BackgroundTransparency = 1, LayoutOrder = 8, }, panel) new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14) }, rosterHead) new("TextLabel", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = 11, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, Text = "ROSTER · click a name to override", }, rosterHead) local rosterWrap = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 9, }, panel) new("UIPadding", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10), PaddingBottom = UDim.new(0, 8), }, rosterWrap) local rosterList = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, }, rosterWrap) new("UIListLayout", { SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, 1) }, rosterList) new("TextLabel", { Size = UDim2.new(1, 0, 0, 22), BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 11, TextColor3 = C.muted, LayoutOrder = 10, Text = "Right Shift · show / hide", }, panel) local rows = {} local function cycleOverride(plr) local cur = state.overrides[plr.UserId] if cur == nil then state.overrides[plr.UserId] = "ally" elseif cur == "ally" then state.overrides[plr.UserId] = "enemy" else state.overrides[plr.UserId] = nil end end local function updateSourceLabel() if state.forced then sourceBtn.Text = (" Team source: %s (forced)"):format(state.forced) elseif state.active then sourceBtn.Text = (" Team source: %s (auto)"):format(state.active.name) else sourceBtn.Text = " Team source: none found" end end sourceBtn.MouseButton1Click:Connect(function() local cands = state.candidates if #cands == 0 then state.forced = nil else local idx = 0 for i, c in ipairs(cands) do if c.name == state.forced then idx = i end end if state.forced == nil then idx = 1 elseif idx >= #cands then idx = 0 else idx += 1 end state.forced = (idx == 0) and nil or cands[idx].name end resolveActive() updateSourceLabel() refreshRoster() end) rendererBtn.MouseButton1Click:Connect(function() local order = { "auto", "drawing", "frames" } local cur = 1 for i, v in ipairs(order) do if v == CONFIG.renderer then cur = i end end CONFIG.renderer = order[(cur % #order) + 1] setRenderer(CONFIG.renderer) rendererBtn.Text = "Renderer: " .. CONFIG.renderer end) refreshRoster = function() local allies, enemies = {}, {} for _, plr in ipairs(Players:GetPlayers()) do if plr ~= LocalPlayer then if CONFIG.teamCheck and isAlly(plr) then table.insert(allies, plr) else table.insert(enemies, plr) end end end local function byName(a, b) return a.Name:lower() < b.Name:lower() end table.sort(allies, byName) table.sort(enemies, byName) local a = state.active if not a then subtitle.Text = "no team field - use the roster" elseif a.same == a.others and a.others > 0 then subtitle.Text = ("%s · everyone in one group"):format(a.group) else subtitle.Text = ("%s · %d ally / %d enemy"):format(a.group, #allies, #enemies) end updateSourceLabel() rendererBtn.Text = "Renderer: " .. tostring(CONFIG.renderer) for _, row in ipairs(rows) do row:Destroy() end rows = {} local index = 0 local function addRow(plr, ally) index += 1 local root, hum = anchorOf(charOf(plr)) local dead = (not root) or (hum and hum.Health <= 0) or false local row = new("TextButton", { Size = UDim2.new(1, 0, 0, 20), BackgroundColor3 = C.surface, BackgroundTransparency = 1, BorderSizePixel = 0, AutoButtonColor = false, Text = "", LayoutOrder = index, }, rosterList) new("UICorner", { CornerRadius = UDim.new(0, 5) }, row) new("Frame", { Size = UDim2.fromOffset(6, 6), Position = UDim2.new(0, 8, 0.5, -3), BackgroundColor3 = ally and allyColor(plr) or C.enemy, BackgroundTransparency = dead and 0.6 or 0, BorderSizePixel = 0, }, row).Parent = row new("TextLabel", { Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(22, 0), BackgroundTransparency = 1, Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = dead and C.muted or C.text, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd, Text = plr.Name, }, row) local manual = state.overrides[plr.UserId] ~= nil new("TextLabel", { Size = UDim2.fromOffset(60, 20), Position = UDim2.new(1, -64, 0, 0), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = 10, TextColor3 = ally and allyColor(plr) or C.enemy, TextXAlignment = Enum.TextXAlignment.Right, Text = (ally and "ALLY" or "ENEMY") .. (manual and " *" or ""), }, row) row.MouseEnter:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), { BackgroundTransparency = 0.55 }):Play() end) row.MouseLeave:Connect(function() TweenService:Create(row, TweenInfo.new(0.12), { BackgroundTransparency = 1 }):Play() end) row.MouseButton1Click:Connect(function() cycleOverride(plr) refreshRoster() end) table.insert(rows, row) end local shown = 0 for _, plr in ipairs(allies) do if shown < 14 then shown += 1 addRow(plr, true) end end for _, plr in ipairs(enemies) do if shown < 14 then shown += 1 addRow(plr, false) end end local total = #allies + #enemies if total == 0 then table.insert(rows, new("TextLabel", { Size = UDim2.new(1, 0, 0, 20), BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, LayoutOrder = 1, Text = " nobody else in the server", }, rosterList)) elseif total > shown then table.insert(rows, new("TextLabel", { Size = UDim2.new(1, 0, 0, 18), BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 11, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, LayoutOrder = index + 1, Text = (" +%d more"):format(total - shown), }, rosterList)) end end -- ───────────────────────────── dragging ────────────────────────── local dragging, dragStart, startPos = false, nil, nil header.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = panel.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) UIS.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then local delta = input.Position - dragStart panel.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) UIS.InputBegan:Connect(function(input, processed) if processed then return end if input.KeyCode == CONFIG.keybind then panel.Visible = not panel.Visible end end) -- ───────────────────────────── render loop ─────────────────────── local rayParams = RaycastParams.new() rayParams.FilterType = Enum.RaycastFilterType.Exclude rayParams.IgnoreWater = true local function hasLineOfSight(char, target) if not CONFIG.wallCheck then return true end local filter = { char } if LocalPlayer.Character then table.insert(filter, LocalPlayer.Character) end rayParams.FilterDescendantsInstances = filter local hit = workspace:Raycast(Camera.CFrame.Position, target - Camera.CFrame.Position, rayParams) return hit == nil end local drawn, seen, warned = 0, 0, false local function hpColor(f) if f > 0.5 then return Color3.fromRGB(255, 200, 70):Lerp(CONFIG.teamColor, (f - 0.5) / 0.5) end return CONFIG.enemyColor:Lerp(Color3.fromRGB(255, 200, 70), f / 0.5) end local function drawPlayer(plr, e, viewport) local char = charOf(plr) local root, hum = anchorOf(char) if not char or not root then return hideESP(e) end if hum and hum.Health <= 0 then return hideESP(e) end local dist = (root.Position - Camera.CFrame.Position).Magnitude if dist > CONFIG.maxDistance or not hasLineOfSight(char, root.Position) then return hideESP(e) end local cf, size local ok = pcall(function() cf, size = char:GetBoundingBox() end) if not ok or not cf then cf = root.CFrame size = root.Size end local half = Vector3.new(0, size.Y * 0.5, 0) local topS, topOn = Camera:WorldToViewportPoint(cf.Position + half) local botS, botOn = Camera:WorldToViewportPoint(cf.Position - half) if not (topOn or botOn) then return hideESP(e) end local right = Camera.CFrame.RightVector * (size.X * 0.5) local rS = Camera:WorldToViewportPoint(cf.Position + right) local lS = Camera:WorldToViewportPoint(cf.Position - right) local cx = (topS.X + botS.X) * 0.5 local topY = math.min(topS.Y, botS.Y) local botY = math.max(topS.Y, botS.Y) local h = botY - topY if h < 8 then return hideESP(e) end local w = math.clamp(math.abs(rS.X - lS.X), h * 0.32, 420) local x = cx - w * 0.5 local ally = CONFIG.teamCheck and isAlly(plr) local color = (not CONFIG.teamCheck and CONFIG.soloColor) or (ally and allyColor(plr) or CONFIG.enemyColor) drawn += 1 e.box.apply({ x = x, y = topY, w = w, h = h, color = color, visible = CONFIG.boxes, thickness = 1, }) local L = math.clamp(math.min(w, h) * 0.22, 6, 18) local seg = { { x, topY, x + L, topY }, { x, topY, x, topY + L }, { x + w, topY, x + w - L, topY }, { x + w, topY, x + w, topY + L }, { x, topY + h, x + L, topY + h }, { x, topY + h, x, topY + h - L }, { x + w, topY + h, x + w - L, topY + h }, { x + w, topY + h, x + w, topY + h - L }, } for i = 1, 8 do local c = e.corner[i] if c then c.apply({ x1 = seg[i][1], y1 = seg[i][2], x2 = seg[i][3], y2 = seg[i][4], color = color, visible = CONFIG.corners, thickness = 2, alpha = 0.2, }) end end e.tag.apply({ cx = cx, cy = topY - 36, text = ally and "ALLY" or "ENEMY", color = color, visible = CONFIG.names }) e.name.apply({ cx = cx, cy = topY - 22, text = plr.Name, color = color, visible = CONFIG.names }) e.dist.apply({ cx = cx, cy = botY + 10, text = ("%d studs"):format(math.floor(dist + 0.5)), color = Color3.fromRGB(210, 216, 228), visible = CONFIG.distance }) if hum then local frac = math.clamp(hum.Health / math.max(hum.MaxHealth, 1), 0, 1) local bx = x - 6 e.hpBg.apply({ x = bx, y = topY, w = 3, h = h, color = Color3.fromRGB(8, 10, 14), visible = CONFIG.health, filled = true }) local fh = math.max(h * frac, 1) e.hp.apply({ x = bx, y = topY + (h - fh), w = 3, h = fh, color = hpColor(frac), visible = CONFIG.health, filled = true }) else pcall(e.hpBg.hide); pcall(e.hp.hide) end e.tracer.apply({ x1 = viewport.X * 0.5, y1 = viewport.Y, x2 = cx, y2 = botY, color = color, visible = CONFIG.tracers, thickness = 1, alpha = 0.55 }) end table.insert(conns, RunService.RenderStepped:Connect(function() if not Camera then return end drawn = 0 local ok, err = pcall(function() local viewport = Camera.ViewportSize seen = 0 for plr, e in pairs(cache) do if plr.Parent then seen += 1 drawPlayer(plr, e, viewport) end end end) if not ok and not warned then warned = true warn("[TeamESP] " .. tostring(err)) diag.Text = "ERR: " .. tostring(err):sub(1, 40) end end)) table.insert(conns, RunService.Heartbeat:Connect(function() diag.Text = ("%s · %dp · %d box · %s"):format( Backend and Backend.name or "none", seen, drawn, state.active and state.active.name or "no source") end)) -- ───────────────────────────── players ────────────────────────── local function addPlayer(plr) if plr == LocalPlayer or cache[plr] then return end local e = makeESP() if e then cache[plr] = e end end local function removePlayer(plr) local e = cache[plr] if e then destroyESP(e) cache[plr] = nil end end table.insert(conns, Players.PlayerAdded:Connect(function(plr) addPlayer(plr); analyze(); resolveActive(); refreshRoster() end)) table.insert(conns, Players.PlayerRemoving:Connect(function(plr) removePlayer(plr) state.overrides[plr.UserId] = nil spawnAllies[plr.UserId] = nil analyze(); resolveActive(); refreshRoster() end)) table.insert(conns, workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() if workspace.CurrentCamera then Camera = workspace.CurrentCamera end end)) table.insert(conns, LocalPlayer.CharacterAdded:Connect(function() analyze(); resolveActive(); refreshRoster() snapshotSpawnGroup() end)) if LocalPlayer.Character then snapshotSpawnGroup() end -- ───────────────────────────── start ──────────────────────────── Backend = buildBackend(CONFIG.renderer) for _, plr in ipairs(Players:GetPlayers()) do addPlayer(plr) end task.spawn(function() refreshCharCache() analyze() resolveActive() refreshRoster() while true do task.wait(2) refreshCharCache() analyze() resolveActive() refreshRoster() end end) -- ───────────────────────────── api ─────────────────────────────── local api = {} function api.destroy() clearESPs() for _, conn in ipairs(conns) do pcall(function() conn:Disconnect() end) end conns = {} if gui then gui:Destroy() gui = nil end if Backend and Backend.gui then Backend.gui:Destroy() end if getgenv then getgenv().TeamESP = nil end end function api.report() return report() end function api.rescan() refreshCharCache(); analyze(); resolveActive(); refreshRoster() end function api.forceSource(name) state.forced = name; resolveActive(); refreshRoster() end function api.renderer(mode) CONFIG.renderer = mode; setRenderer(mode) end function api.markNearest(n) local myRoot = anchorOf(LocalPlayer.Character) if not myRoot then return end local scored = {} for _, p in ipairs(Players:GetPlayers()) do if p ~= LocalPlayer then local root = anchorOf(charOf(p)) if root then table.insert(scored, { p = p, d = (root.Position - myRoot.Position).Magnitude }) end end end table.sort(scored, function(a, b) return a.d < b.d end) for i = 1, math.min(n or 5, #scored) do state.overrides[scored[i].p.UserId] = "ally" end refreshRoster() end if getgenv then getgenv().TeamESP = api end