local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local ESP_ENABLED = true -- starts on, press Insert to toggle local MAX_DISTANCE = 350 local ESP_BOXES = {} local function GetCharacterSize(char) if not char then return Vector3.new(4, 6, 4) end local humanoid = char:FindFirstChildOfClass("Humanoid") if not humanoid then return Vector3.new(4, 6, 4) end local base = Vector3.new(4, 5.8, 4) -- better R15 average if humanoid.HipHeight > 2 then base = base + Vector3.new(0, humanoid.HipHeight - 2, 0) end return base end local function CreateOrUpdateBox(player) if player == LocalPlayer then return end local box = ESP_BOXES[player] if not box then box = Instance.new("BoxHandleAdornment") box.Name = "ESPBox" box.Transparency = 0.65 box.AlwaysOnTop = true box.ZIndex = 10 box.Visible = false ESP_BOXES[player] = box end -- We'll re-parent & resize when character spawns end local function OnCharacterAdded(char, player, box) if not char or not box then return end local root = char:WaitForChild("HumanoidRootPart", 8) if not root then return end box.Adornee = root box.Size = GetCharacterSize(char) box.Parent = char -- parent to character (less detectable than CoreGui in many games) end local function SetupPlayer(player) if player == LocalPlayer then return end CreateOrUpdateBox(player) local box = ESP_BOXES[player] local function handleChar(char) OnCharacterAdded(char, player, box) end if player.Character then handleChar(player.Character) end player.CharacterAdded:Connect(handleChar) -- Clean up on leaving player.AncestryChanged:Connect(function() if not player:IsDescendantOf(game) then if box then box:Destroy() end ESP_BOXES[player] = nil end end) end -- Initialize existing players for _, plr in Players:GetPlayers() do SetupPlayer(plr) end Players.PlayerAdded:Connect(SetupPlayer) -- Main update loop local myRootCache = nil RunService.RenderStepped:Connect(function() if not ESP_ENABLED then for _, box in ESP_BOXES do box.Visible = false end return end local myChar = LocalPlayer.Character if not myChar then myRootCache = nil return end myRootCache = myChar:FindFirstChild("HumanoidRootPart") or myRootCache for player, box in ESP_BOXES do if not player or not player.Character or player.Team == LocalPlayer.Team then box.Visible = false continue end local root = player.Character:FindFirstChild("HumanoidRootPart") if not root or not myRootCache then box.Visible = false continue end local dist = (root.Position - myRootCache.Position).Magnitude if dist > MAX_DISTANCE then box.Visible = false continue end -- Distance-based color + slight transparency fade local t = math.clamp(dist / MAX_DISTANCE, 0, 1) local r = 1 local g = 1 - t local b = 0 if dist < 60 then r, g, b = 1, 0, 0 -- close = red elseif dist < 140 then r, g, b = 1, 0.65, 0 -- mid = orange else r, g, b = 1, 1, 0 -- far = yellow end box.Color3 = Color3.new(r, g, b) box.Transparency = 0.4 + (t * 0.4) -- 0.4 → 0.8 fade out box.Visible = true end end) -- Toggle with Insert key UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.Insert then ESP_ENABLED = not ESP_ENABLED print("ESP " .. (ESP_ENABLED and "ENABLED" or "DISABLED")) end end)