local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local TextureInfo = require(game:GetService("ReplicatedStorage"):WaitForChild("TextureInfo")) local Camera = workspace.CurrentCamera local chunksFolder = workspace.Chunks local xrayEnabled = false local oreColors = { coalore = Color3.fromRGB(40, 40, 40), ironore = Color3.fromRGB(210, 105, 30), goldore = Color3.fromRGB(255, 215, 0), diamondore = Color3.fromRGB(0, 255, 255), } local oreTextureIDs = {} for name in oreColors do local id = TextureInfo[name] if id then oreTextureIDs[tostring(id):match("%d+$")] = name end end local activeEsp = {} local oreCache = {} local function getOreType(part: BasePart): string? for _, obj in part:GetChildren() do if (obj:IsA("Decal") or obj:IsA("Texture")) and obj.Texture then local id = obj.Texture:match("%d+$") if id and oreTextureIDs[id] then return oreTextureIDs[id] end end end return nil end local function cleanEsp(part: BasePart) local data = activeEsp[part] if not data then return end data.Box:Remove() data.Label:Remove() activeEsp[part] = nil end chunksFolder.DescendantAdded:Connect(function(p) if p:IsA("BasePart") and getOreType(p) then table.insert(oreCache, p) end end) chunksFolder.DescendantRemoving:Connect(function(p) cleanEsp(p) local idx = table.find(oreCache, p) if idx then table.remove(oreCache, idx) end end) table.clear(oreCache) for _, part in chunksFolder:GetDescendants() do if part:IsA("BasePart") and getOreType(part) then table.insert(oreCache, part) end end RunService.PreRender:Connect(function() if not xrayEnabled then for part in activeEsp do cleanEsp(part) end return end for _, part in oreCache do local screenPos, onScreen = Camera:WorldToViewportPoint(part.Position) if onScreen then local data = activeEsp[part] if not data then local oreType = getOreType(part) local color = oreColors[oreType] local box = Drawing.new("Square") box.Thickness = 1 box.Color = color box.Transparency = 1 local label = Drawing.new("Text") label.Size = 13 label.Center = true label.Outline = true label.Color = color label.Text = oreType:gsub("ore", ""):upper() data = {Box = box, Label = label} activeEsp[part] = data end local size = 1000 / screenPos.Z local half = size / 2 data.Box.Position = Vector2.new(screenPos.X - half, screenPos.Y - half) data.Box.Size = Vector2.new(size, size) data.Box.Visible = true data.Label.Position = Vector2.new(screenPos.X, screenPos.Y + half) data.Label.Visible = true elseif activeEsp[part] then activeEsp[part].Box.Visible = false activeEsp[part].Label.Visible = false end end end) UIS.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.X then xrayEnabled = not xrayEnabled end end)