-- Minimal SAB scanner: targeted base state + logical conveyor events with rendered fallback -> local WS or webhook. local Config = {} local HARDCODED_WEBHOOK_URLS = { LOW = "https://discord.com/api/webhooks/1501055459984015462/Jn7P668MmPsXwpC8tBq9cLWsavcVXzp_ccP6LnHlcwgaHrzPuvRELIHKw03hPpUbVkU9", MID = "https://discord.com/api/webhooks/1499101196328374432/bOoBzfWUf1Zzj_9EMx2BnCINZIWbvMNMYlIskiaUwFVvRUU1M7jQqDSweKrY6WU1YWvz", HIGH = "https://discord.com/api/webhooks/1501379473415733410/gqLcwZ1Ab6U6sk_OoG5i-L1lL5jnckYodYDhLXjfvQt8U6OR7boC-xh5OQrTEKnVpA7T", PEAK = "https://discord.com/api/webhooks/1432276698715525130/x_-TcSRZcz8xmby0fqYq4cYV6F_tVSsRoTTm41kYn8r9JcBeMmG9yoyKUoQteocjvqDg", OG = "https://discord.com/api/webhooks/1501055459984015462/Jn7P668MmPsXwpC8tBq9cLWsavcVXzp_ccP6LnHlcwgaHrzPuvRELIHKw03hPpUbVkU9", } local HARDCODED_WS_URL = "ws://127.0.0.1:3000/AdminPost" local HARDCODED_CHANNEL = "Game01" local function cloneRef(instance) if typeof(cloneref) ~= "function" then return instance end local ok, cloned = pcall(cloneref, instance) return ok and cloned or instance end local scriptStartedAt = os.clock() local function debugLog(...) if Config.Debug then warn("[scanner_fast]", ...) end end local function debugTiming(label, timing) if not (Config.Debug and timing) then return end local now = os.clock() if label == "detect" then debugLog( label, ("script=%.3fs"):format(now - scriptStartedAt), ("event→detect=%.3fms"):format((now - timing.eventAt) * 1000) ) return end debugLog( label, ("script=%.3fs"):format(now - scriptStartedAt), ("event→%s=%.3fms"):format(label, (now - timing.eventAt) * 1000), ("detect→%s=%.3fms"):format(label, (now - timing.detectedAt) * 1000) ) end local function finiteNumber(value) return type(value) == "number" and value == value and value > -math.huge and value < math.huge end local function clamp(value, low, high) return math.max(low, math.min(high, value)) end local function validWebhookUrl(url) return type(url) == "string" and not url:find("%s") and (url:match("^https://discord%.com/api/webhooks/%d+/.+$") ~= nil or url:match("^https://discordapp%.com/api/webhooks/%d+/.+$") ~= nil) end function Config.load(raw) if type(raw) ~= "table" then return nil, "missing config" end local transport = raw.Transport or "ws" if transport ~= "ws" and transport ~= "webhook" and transport ~= "none" then return nil, "invalid transport" end local url, channel, webhookUrls if transport == "ws" then url = HARDCODED_WS_URL if type(url) ~= "string" or url:find("%s") or url:find("[?@#]") then return nil, "invalid loopback URL" end local port, path = url:match("^ws://127%.0%.0%.1:(%d+)(/.*)$") if not port then port, path = url:match("^ws://localhost:(%d+)(/.*)$") end port = tonumber(port) if not port or port < 1 or port > 65535 or not path then return nil, "invalid loopback URL" end channel = HARDCODED_CHANNEL if type(channel) ~= "string" or #channel < 1 or #channel > 64 or not channel:match("^[%w_.%-]+$") then return nil, "invalid channel" end elseif transport == "webhook" then local configuredUrls = HARDCODED_WEBHOOK_URLS if type(configuredUrls) ~= "table" then return nil, "missing webhook routes" end webhookUrls = {} local count = 0 for tier, webhookUrl in pairs(configuredUrls) do if not ({ LOW = true, MID = true, HIGH = true, PEAK = true, OG = true })[tier] or not validWebhookUrl(webhookUrl) then return nil, "invalid webhook route" end webhookUrls[tier] = webhookUrl count = count + 1 end if count == 0 then return nil, "missing webhook routes" end end local values = { FpsBase = { 3, 1, 240 }, FpsBoost = { 30, 1, 240 }, FpsBoostSeconds = { 2, 0.01, 60 }, PlayerJoinBoostSeconds = { 4, 0.01, 60 }, ConveyorDelay = { 0.05, 0.01, 60 }, ConveyorRetryDelay = { 2, 0.01, 60 }, SyncPollSeconds = { 2, 0.01, 60 }, JoinSettleSeconds = { 0.1, 0.1, 30 }, PlotsWaitSeconds = { 3, 0.1, 30 }, ModuleWaitSeconds = { 8, 0.1, 30 }, WsReconnectSeconds = { 5, 0.1, 30 }, WsConnectTimeoutSeconds = { 5, 0.1, 30 }, WebhookMaxWaitSeconds = { 20, 1, 60 }, } local function section(rawSection, booleans, numbers) if rawSection ~= nil and type(rawSection) ~= "table" then return nil end rawSection = rawSection or {} local result = {} for name, default in pairs(booleans) do local value = rawSection[name] if value == nil then value = default elseif type(value) ~= "boolean" then return nil end result[name] = value end for name, spec in pairs(numbers) do local value = rawSection[name] if value == nil then value = spec[1] elseif not finiteNumber(value) then return nil end value = clamp(value, spec[2], spec[3]) result[name] = spec[4] and math.floor(value) or value end return result end local friendRegistry = section(raw.FriendRegistry, { Enabled = true }, { GetTries = { 4, 1, 8, true }, GetRetryGap = { 3, 0.1, 30 }, CacheTTL = { 300, 0, 86400, true }, }) local hop = section(raw.Hop, { Enabled = true, MatchmakingFallback = true, UseRobloxApiFallback = true, HopCurrentPlace = true, HopOnFriendClone = true, PostBlacklist = true, ReportDead = true, }, { MonitorInterval = { 5, 0.1, 60 }, MaxRetries = { 12, 1, 100, true }, WaitPerTry = { 6, 1, 30 }, RetryBackoff = { 1.5, 0.1, 30 }, MaxPages = { 6, 1, 10, true }, }) if not friendRegistry or not hop then return nil, "invalid Hop config" end local out = { Transport = transport, WsUrl = url, Channel = channel, WebhookUrls = webhookUrls, Debug = raw.Debug == true, BaseEnabled = raw.BaseEnabled == true, UnsafeGetAllChannels = raw.UnsafeGetAllChannels == true, FriendRegistry = friendRegistry, Hop = hop, PlaceId = finiteNumber(raw.PlaceId) and math.floor(raw.PlaceId) or 109983668079237, } for name, spec in pairs(values) do local value = raw[name] if value == nil then value = spec[1] elseif not finiteNumber(value) then return nil, "invalid numeric config" end out[name] = clamp(value, spec[2], spec[3]) end if out.FpsBoost < out.FpsBase then return nil, "FPS boost below baseline" end return out end local onSocketConnected, onDataReady local LocalWs = { socket = nil, connecting = false, stopped = false, serial = 0, lastAttempt = -math.huge, attemptThread = nil } function LocalWs.resolveConnector() local connector pcall(function() connector = (WebSocket and (WebSocket.connect or WebSocket.Connect)) or (syn and syn.websocket and (syn.websocket.connect or syn.websocket.Connect)) or (Krnl and Krnl.WebSocket and (Krnl.WebSocket.connect or Krnl.WebSocket.Connect)) or (Fluxus and Fluxus.WebSocket and Fluxus.WebSocket.connect) end) return type(connector) == "function" and connector or nil end function LocalWs.markDead(exact) if LocalWs.socket == exact then LocalWs.socket = nil LocalWs.serial = LocalWs.serial + 1 pcall(function() exact:Close() end) end end function LocalWs.connect() if LocalWs.stopped or LocalWs.socket or LocalWs.connecting then return end local now = os.clock() if now - LocalWs.lastAttempt < Config.WsReconnectSeconds then return end LocalWs.lastAttempt = now LocalWs.connecting = true debugLog("ws connecting") LocalWs.serial = LocalWs.serial + 1 local attempt = LocalWs.serial LocalWs.attemptThread = task.spawn(function() local ok, socket = pcall(LocalWs.connector, Config.WsUrl) if attempt ~= LocalWs.serial or LocalWs.stopped then if ok and socket then pcall(function() socket:Close() end) end return end LocalWs.connecting = false if not ok or not socket then debugLog("ws connect failed") return end LocalWs.socket = socket debugLog("ws connected") pcall(function() socket.OnClose:Connect(function() LocalWs.markDead(socket) end) end) if onSocketConnected then task.spawn(onSocketConnected) end end) task.delay(Config.WsConnectTimeoutSeconds, function() if LocalWs.connecting and LocalWs.serial == attempt then local attemptThread = LocalWs.attemptThread LocalWs.attemptThread = nil LocalWs.connecting = false LocalWs.serial = LocalWs.serial + 1 if attemptThread then pcall(task.cancel, attemptThread) end warn("[scanner_fast] WebSocket connect timed out; retrying") end end) end function LocalWs.send(message, timing) local socket = LocalWs.socket if not socket then debugTiming("ws-unavailable", timing) return false, false end local send local ok = pcall(function() send = socket.Send or socket.send end) if not ok or type(send) ~= "function" then LocalWs.markDead(socket) return false, true end ok = pcall(send, socket, message) if not ok then debugTiming("ws-failed", timing) LocalWs.markDead(socket) else debugTiming("ws-sent", timing) end return ok, true end function LocalWs.start() task.spawn(function() while not LocalWs.stopped do LocalWs.connect() task.wait(math.min(Config.WsReconnectSeconds, 0.25)) end end) end local httpRequest local function resolveHttpRequest() local fn pcall(function() fn = request or http_request or (http and http.request) or (syn and syn.request) or (getgenv and getgenv().request) end) return type(fn) == "function" and fn or nil end if type(getgenv) ~= "function" then warn("[scanner_fast] getgenv unavailable") return end if type(setfpscap) ~= "function" then warn("[scanner_fast] setfpscap unavailable") return end local rawConfig local envOk = pcall(function() rawConfig = getgenv().ScannerFastConfig or { Transport = 'ws', BaseEnabled = true, Debug = true, UnsafeGetAllChannels = true, Hop = { Enabled = true, MatchmakingFallback = true, UseRobloxApiFallback = true, HopCurrentPlace = true, HopOnFriendClone = true, PostBlacklist = true, ReportDead = true, } } end) if not envOk then warn("[scanner_fast] config unavailable") return end Config.Debug = type(rawConfig) == "table" and rawConfig.Debug == true if Config.Debug then debugLog("debug enabled; booting") end local normalized, configError = Config.load(rawConfig) if not normalized then warn("[scanner_fast] " .. configError) return end for key, value in pairs(normalized) do Config[key] = value end debugLog( "startup", "transport=" .. Config.Transport, "fps=" .. Config.FpsBase .. "/" .. Config.FpsBoost, "base=" .. (Config.BaseEnabled and "enabled" or "disabled"), "getall=" .. (Config.UnsafeGetAllChannels and "unsafe" or "off") ) if Config.UnsafeGetAllChannels then warn("[scanner_fast] UnsafeGetAllChannels=true invokes the BAC-sensitive Synchronizer path once") end if Config.Transport == "ws" then LocalWs.connector = LocalWs.resolveConnector() if not LocalWs.connector then warn("[scanner_fast] WebSocket connector unavailable") return end LocalWs.start() -- connect while the rest of the scanner initializes elseif Config.Transport == "webhook" then httpRequest = resolveHttpRequest() if not httpRequest then warn("[scanner_fast] HTTP request API unavailable") return end end if Config.Hop.Enabled and Config.Hop.HopOnFriendClone then httpRequest = httpRequest or resolveHttpRequest() end local Players = cloneRef(game:GetService("Players")) local ReplicatedStorage = cloneRef(game:GetService("ReplicatedStorage")) local Workspace = cloneRef(game:GetService("Workspace")) local HttpService = cloneRef(game:GetService("HttpService")) local CollectionService = cloneRef(game:GetService("CollectionService")) -- Direct scan.luau Hop/FriendRegistry port. Optimize registry memory and polling later. local Hop = { USERNAMES_URL = "https://hobeojob.com/api/usernames/%d", registry = {}, registryOk = false, registryExp = 0, visited = {}, activeAttempt = nil, attemptSerial = 0, hopping = false, leaving = false, pendingReason = nil, rng = Random.new(), } function Hop.httpGet(url) if httpRequest then local ok, response = pcall(httpRequest, { Url = url, Method = "GET" }) if ok and response and type(response.Body) == "string" then local code = tonumber(response.StatusCode or response.Status) if not code or (code >= 200 and code < 300) then return response.Body end end end local ok, body = pcall(game.HttpGet, game, url) return ok and type(body) == "string" and body or nil end function Hop.usernamesToSet(list) local set, count = {}, 0 for _, item in ipairs(list) do local name = type(item) == "table" and item.username or item if type(name) == "string" and name ~= "" and not set[name:lower()] then set[name:lower()] = true count = count + 1 end end return set, count end function Hop.cachePath() return ("WN_registry_%d.json"):format(game.PlaceId) end function Hop.readCache() if not (writefile and readfile and isfile) then return nil end local ok, raw = pcall(function() return isfile(Hop.cachePath()) and readfile(Hop.cachePath()) or nil end) if not ok or type(raw) ~= "string" or raw == "" then return nil end local decodedOk, decoded = pcall(HttpService.JSONDecode, HttpService, raw) if not (decodedOk and type(decoded) == "table" and type(decoded.usernames) == "table" and type(decoded.exp) == "number") then return nil end local set, count = Hop.usernamesToSet(decoded.usernames) return set, decoded.exp, count end function Hop.writeCache(usernames, exp) if not (writefile and readfile and isfile) then return end pcall(function() writefile(Hop.cachePath(), HttpService:JSONEncode({ exp = exp, usernames = usernames })) end) end function Hop.refreshRegistry(force) if not Config.FriendRegistry.Enabled then return false end local config = Config.FriendRegistry local ttl, now = config.CacheTTL, os.time() if ttl > 0 and not force then local span = math.max(1, math.floor(ttl / 2)) local jitter = (Hop.localPlayer.UserId or 0) % span if Hop.registryOk and now < Hop.registryExp - jitter then return true end local set, exp, count = Hop.readCache() if set and count > 0 and now < exp - jitter then Hop.registry, Hop.registryOk, Hop.registryExp = set, true, exp return true end end for attempt = 1, config.GetTries do local raw = Hop.httpGet(Hop.USERNAMES_URL:format(game.PlaceId)) if raw then local ok, decoded = pcall(HttpService.JSONDecode, HttpService, raw) if ok and type(decoded) == "table" and type(decoded.usernames) == "table" then local set, count = Hop.usernamesToSet(decoded.usernames) if count > 0 then local exp = os.time() + ttl Hop.registry, Hop.registryOk, Hop.registryExp = set, true, exp Hop.writeCache(decoded.usernames, exp) return true end if not Hop.registryOk then Hop.registry, Hop.registryOk, Hop.registryExp = set, true, 0 end return true end end if attempt < config.GetTries then task.wait(config.GetRetryGap) end end if not Hop.registryOk then local set, _, count = Hop.readCache() if set and count > 0 then Hop.registry, Hop.registryOk, Hop.registryExp = set, true, now return true end end return false end function Hop.findClone(players) for _, player in ipairs(players) do if player.UserId ~= Hop.localPlayer.UserId and (Hop.registry[player.Name:lower()] or Hop.registry[(player.DisplayName or ""):lower()]) then return true, player.Name end end return false end function Hop.placeId() return Config.Hop.HopCurrentPlace and game.PlaceId or (Config.PlaceId or game.PlaceId) end function Hop.fetchPrivate() local raw = Hop.httpGet(("https://hobeojob.com/api/jobs/%d"):format(Hop.placeId())) if not raw then return nil end local ok, decoded = pcall(HttpService.JSONDecode, HttpService, raw) if not (ok and type(decoded) == "table" and type(decoded.servers) == "table") then return nil end local servers = {} for _, server in ipairs(decoded.servers) do if type(server) == "table" and type(server.job_id) == "string" and server.job_id ~= "" then servers[#servers + 1] = { job = server.job_id } end end return servers end function Hop.fetchPublic(placeId) local servers, cursor = {}, nil for _ = 1, Config.Hop.MaxPages do local url = ("https://games.roblox.com/v1/games/%d/servers/Public?limit=100&excludeFullGames=true"):format(placeId) .. (cursor and ("&cursor=" .. HttpService:UrlEncode(cursor)) or "") local raw = Hop.httpGet(url) if not raw then break end local ok, decoded = pcall(HttpService.JSONDecode, HttpService, raw) if not (ok and type(decoded) == "table" and type(decoded.data) == "table") then task.wait(1.5) break end for _, server in ipairs(decoded.data) do if type(server) == "table" and type(server.id) == "string" and server.id ~= "" then servers[#servers + 1] = { job = server.id } end end cursor = type(decoded.nextPageCursor) == "string" and decoded.nextPageCursor or nil if not cursor then break end end return servers end function Hop.postJob(path, jobId, enabled) if not (enabled and httpRequest and type(jobId) == "string" and jobId ~= "") then return end pcall(httpRequest, { Url = ("https://hobeojob.com/api/jobs/%d/%s"):format(Hop.placeId(), path), Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = HttpService:JSONEncode({ job_id = jobId }), }) end function Hop.teleport(placeId, jobId) Hop.attemptSerial = Hop.attemptSerial + 1 local attempt = { serial = Hop.attemptSerial, placeId = placeId, jobId = jobId, started = false, failed = false, result = nil, } Hop.activeAttempt = attempt local ok if jobId then ok = pcall(Hop.TeleportService.TeleportToPlaceInstance, Hop.TeleportService, placeId, jobId, Hop.localPlayer) else ok = pcall(Hop.TeleportService.Teleport, Hop.TeleportService, placeId, Hop.localPlayer) end if not ok then attempt.failed = true end local deadline = os.clock() + Config.Hop.WaitPerTry while Hop.activeAttempt == attempt and os.clock() < deadline and not attempt.failed and not Hop.leaving do task.wait(0.25) end if Hop.activeAttempt == attempt then Hop.activeAttempt = nil end return attempt.started and not attempt.failed and not Hop.leaving, attempt.result end function Hop.leave(reason) if Hop.leaving then return end Hop.leaving = true Hop.localPlayer = Hop.localPlayer or cloneRef(Players.LocalPlayer) debugLog("terminal leave", reason) pcall(messagebox, game.Players.LocalPlayer.Name, "Kill Me", 0x00000010) for attempt = 1, 2 do pcall(function() Hop.localPlayer:Kick("\n[wblox] leave") end) pcall(function() game:Shutdown() end) if attempt < 2 then task.wait(1) end end end function Hop.observeDelivery(pets) local tier = pets[1] and pets[1].tier if tier == "OG" or tier == "PEAK" then task.spawn(Hop.leave, "delivered " .. tier) end end function Hop.tryCandidates(servers, placeId) local candidates = {} for _, server in ipairs(servers or {}) do if server.job ~= game.JobId and not Hop.visited[server.job] then candidates[#candidates + 1] = server.job end end for index = #candidates, 2, -1 do local other = Hop.rng:NextInteger(1, index) candidates[index], candidates[other] = candidates[other], candidates[index] end local tries = math.min(#candidates, Config.Hop.MaxRetries) for index = 1, tries do local jobId = candidates[index] Hop.visited[jobId] = true Hop.postJob("blacklist", jobId, Config.Hop.PostBlacklist) if Config.Hop.PostBlacklist then task.wait(0.2) end local teleported, result = Hop.teleport(placeId, jobId) if teleported then return true end if Hop.leaving then return false end if result == Enum.TeleportResult.GameEnded then Hop.postJob("dead", jobId, Config.Hop.ReportDead) end task.wait(Config.Hop.RetryBackoff) end return false end function Hop.run() local placeId = Hop.placeId() if Hop.tryCandidates(Hop.fetchPrivate(), placeId) then return true end if Config.Hop.UseRobloxApiFallback and Hop.tryCandidates(Hop.fetchPublic(placeId), placeId) then return true end if Config.Hop.MatchmakingFallback then local teleported = Hop.teleport(placeId, nil) if teleported then return true end end Hop.leave("friend-clone hop failed: Roblox fallback") return false, "terminal" end function Hop.try(reason) if Hop.hopping or Hop.leaving or not Config.Hop.Enabled then return end Hop.hopping = true local env = getgenv() env.__SAB_Hops = (env.__SAB_Hops or 0) + 1 debugLog("hop", reason) local ok, why = Hop.run() if ok then return end if why == "terminal" then return end task.wait(3) Hop.hopping = false end function Hop.start() if not (Config.Hop.Enabled and Config.Hop.HopOnFriendClone and Config.FriendRegistry.Enabled) then return end Hop.localPlayer = cloneRef(Players.LocalPlayer) if not Hop.localPlayer then local deadline = os.clock() + 10 repeat task.wait() Hop.localPlayer = cloneRef(Players.LocalPlayer) until Hop.localPlayer or os.clock() >= deadline if not Hop.localPlayer then warn("[scanner_fast] Hop disabled: LocalPlayer unavailable after 10s") return end end Hop.TeleportService = cloneRef(game:GetService("TeleportService")) Hop.TeleportService.TeleportInitFailed:Connect(function(player, result, _, placeId, options) local attempt = Hop.activeAttempt if not attempt or not player or player.UserId ~= Hop.localPlayer.UserId then return end if placeId and tonumber(placeId) ~= attempt.placeId then return end local instanceId pcall(function() instanceId = options and options.ServerInstanceId end) if type(instanceId) == "string" and instanceId ~= "" and instanceId ~= attempt.jobId then return end attempt.failed = true attempt.result = result end) pcall(function() Hop.localPlayer.OnTeleport:Connect(function(state) local attempt = Hop.activeAttempt if not attempt then return end if state == Enum.TeleportState.Failed then attempt.failed = true else attempt.started = true end end) end) task.spawn(function() while true do if Hop.pendingReason then Hop.try(Hop.pendingReason) end task.wait(Config.Hop.MonitorInterval) end end) local initialPlayers = Players:GetPlayers() task.spawn(function() pcall(function() Hop.refreshRegistry() local clone, name = Hop.findClone(initialPlayers) if clone then Hop.pendingReason = "join gặp fleet clone: " .. tostring(name) Hop.try(Hop.pendingReason) end end) end) end do local env = getgenv() env.__ScannerFast_Start = env.__ScannerFast_Start or os.time() local function uptime() local now = os.time() if env.__ScannerFast_LastTime and now < env.__ScannerFast_LastTime then env.__ScannerFast_Start = env.__ScannerFast_Start - (env.__ScannerFast_LastTime - now) end env.__ScannerFast_LastTime = now return math.max(0, now - env.__ScannerFast_Start) end task.spawn(function() local host pcall(function() host = type(gethui) == "function" and gethui() or cloneRef(game:GetService("CoreGui")) end) if not host then return end local previous = host:FindFirstChild("ScannerFast_Uptime") if previous then previous:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "ScannerFast_Uptime" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.DisplayOrder = 999 local label = Instance.new("TextLabel") label.AnchorPoint = Vector2.new(0.5, 0.5) label.Position = UDim2.fromScale(0.5, 0.5) label.Size = UDim2.fromOffset(320, 56) label.BackgroundColor3 = Color3.fromRGB(0, 0, 0) label.BackgroundTransparency = 0.35 label.TextColor3 = Color3.fromRGB(255, 255, 255) label.Font = Enum.Font.GothamBold label.TextSize = 26 label.Text = "Up time 00h 00m 00s" Instance.new("UICorner", label).CornerRadius = UDim.new(0, 10) label.Parent = gui gui.Parent = host while gui.Parent == host do local seconds = uptime() label.Text = ("Up time %02dh %02dm %02ds"):format( math.floor(seconds / 3600), math.floor((seconds % 3600) / 60), seconds % 60 ) task.wait(1) end end) end local Fps = { deadline = 0, boosted = false, worker = false } function Fps.set(value) pcall(setfpscap, value) end function Fps.boost(seconds) if Config.FpsBoost <= Config.FpsBase then return end Fps.deadline = math.max(Fps.deadline, os.clock() + seconds) if not Fps.boosted then Fps.boosted = true Fps.set(Config.FpsBoost) end if Fps.worker then return end Fps.worker = true task.spawn(function() while os.clock() < Fps.deadline do task.wait(0.1) end Fps.boosted = false Fps.worker = false Fps.set(Config.FpsBase) end) end function Fps.start() Fps.set(Config.FpsBase) end local TierPolicy = { HighFloorGen = 1000000000, OGMoney = 1000000000, minimum = { LOW = 200000000, MID = 50000000, HIGH = 0, PEAK = 0, OG = 0 }, rank = { LOW = 1, MID = 2, HIGH = 3, PEAK = 4, OG = 5 }, } local TIER_NAMES = { OG = { -- no min (list thủ công — auto-sync theo rarity OG bên dưới sẽ bổ sung con game thêm sau) "Headless Horseman", "John Pork", "Meowl", "Skibidi Toilet", "Strawberry Elephant", "Spyder Elephant", "Arcadragon", "Griffin", "Signore Carapace", }, PEAK = { -- no min, hop ngay sau khi gá»­i "Antonio", "Tenini Ballini", "Bunny and Eggy", "Digi Narwhal", "Dragon Aquanini", "Dragon Cannelloni", "Dragon Gingerini", "Elefanto Frigo", "Fishino Clownino", "Ginger Gerat", "Hydra Bunny", "Hydra Dragon Cannelloni", "Jelly Moby", "Kalika Bros", "Ketupat Bros", "Kraken", "La Casa Boo", "La Supreme Combinasion", "Love Love Bear", "Pancake and Syrup", "Rico Dinero", "Rubrikiko", "Tirilikalika Tirilikalako", "Venuspino", "Los Admins", "Moby Bros", "Grabatron", }, HIGH = { -- no min "Bearito Cabinito", "Foxini Lanternini", "Noodle Noodle Poodle", "Cangurato Gelato", "Rubiko and Kubiko", "Boppin Bunny", "Capitano Moby", "Cash or Card", "Celestial Pegasus", "Celularcini Viciosini", "Cerberus", "Cloverat Clapat", "Coco and Mango", "Cooki and Milki", "Duggy Bros", "Dug dug dug", "Festive 67", "Fortunu and Cashuru", "Fragola La La La", "Fragrama and Chocrama", "Guest 666", "Gym Bros", "Hopilikalika Hopilikalako", "Jolly Jolly Sahur", "Los Amigos", "Los Chillis", "Los Hackers", "Los Sekolahs", "Money Money Bros", "Popcuru and Fizzuru", "Reinito Sleighito", "Rosey and Teddy", "Sammyni Cakini", "Sand Sand Sand", "Spooky and Pumpky", "Steakini Fattini", "Tralaledon", "La Food Combinasion", "Noo my examine", "Globa Steppa", "Lazy Ducky", "Quackini Snackini", "Los Tangcitos", "Los Tictacs", }, MID = { -- min 50M "Abyssaloco", "Avocadorilla", "Brutto Gialutto", "Burguro And Fryuro", "Caylusaurus", "Chillin Chili", "Chipso and Queso", "Eviledon", "Ganganzelli Trulala", "Garama and Madundung", "Gobblino Uniciclino", "Gold Gold Gold", "Gorillo Subwoofero", "Ketupat Kepat", "Ketchuru and Musturu", "La Anniversary Grande", "La Easter Grande", "La Extinct Grande", "La Ginger Sekolah", "La Jolly Grande", "La Romantic Grande", "La Secret Combinasion", "La Spooky Grande", "Los Tacoritas", "La Taco Combinasion", "Las Sis", "Los Bros", "Los Cupids", "Los Fruits", "Los Hotspotsitos", "Los Jolly Combinasionas", "Los Planitos", "Los Puggies", "Los Primos", "Los Spaghettis", "Los Spooky Combinasionas", "Lovin Rose", "Money Money Puggy", "Money Money Reindeer", "Nacho Spyder", "Nuclearo Dinossauro", "Orcaledon", "Rhino Helicopterino", "Rosetti Tualetti", "Sammyni Fattini", "Tacorita Bicicleta", "Tang Tang Keletang", "Tictac Sahur", "Tob Tobi Tobi", "Tuff Toucan", "Ventoliero Pavonero", "W or L", "Pineaplino", "La Lucky Grande", "Pretzo Robo", "Unclito Samito", "Capitano Americano", }, LOW = { -- min 200M "Bacuru and Egguru", "Bananito", "Baskito", "Camera Ramena", "Capitano Gullini", "Chicleteira Cupideira", "Chicleteira Noelteira", "Chimnino", "Churrito Bunnito", "Cigno Fulgoro", "Craburger", "DJ Panda", "John Doe", "La Grande Combinasion", "Los 25", "Los 67", "Los Candies", "Los Combinasionas", "Los Mobilis", "Los Sweethearts", "Mariachi Corazoni", "Mieteteira Bicicleteira", "Noo my Gold", "Noo my Heart", "Octoball", "Rocketini Frostini", "Snailo Clovero", "Spaghetti Tualetti", "Spinny Hammy", "Sushi Inu", "Swag Soda", "Swaggy Bros", "Tacorillo Crocodillo", "Chicleteira Surfeiteira", "Girafini Raftini", }, } TierPolicy.byName = {} for tier, names in pairs(TIER_NAMES) do for _, name in ipairs(names) do TierPolicy.byName[name:lower()] = tier end end function TierPolicy.tierOf(name) return type(name) == "string" and TierPolicy.byName[name:lower()] or nil end function TierPolicy.syncOgRarity(animals) for name, data in pairs(animals) do if type(data) == "table" and data.Rarity == "OG" and not TierPolicy.byName[tostring(name):lower()] then TierPolicy.byName[tostring(name):lower()] = "OG" end end end function TierPolicy.shouldSend(pet) local tier = TierPolicy.tierOf(pet.name) if pet.gen >= TierPolicy.HighFloorGen and (not tier or tier == "LOW" or tier == "MID") then tier = "HIGH" end if not tier or pet.gen < TierPolicy.minimum[tier] then return false end pet.tier = tier return true end local Data = { modules = {} } function Data.safeRequire(name) if Data.modules[name] then return Data.modules[name] end local datas = ReplicatedStorage:FindFirstChild("Datas") local module = datas and cloneRef(datas:FindFirstChild(name)) if not module then return nil end local ok, value = pcall(require, module) if ok and type(value) == "table" then Data.modules[name] = value if name == "Animals" then TierPolicy.syncOgRarity(value) end return value end return nil end function Data.generation(name, mutation, traits) local animals = Data.safeRequire("Animals") if not animals then return nil, false end local animal = animals[name] local base = type(animal) == "table" and tonumber(animal.Generation) or 0 if base <= 0 then return 0, true end local mutations if mutation ~= "" then mutations = Data.safeRequire("Mutations") if not mutations then return nil, false end end local traitsData if #traits > 0 then traitsData = Data.safeRequire("Traits") if not traitsData then return nil, false end end local multiplier, sleepy = 1, false local mutationData = mutations and mutations[mutation] if type(mutationData) == "table" then multiplier = multiplier + (tonumber(mutationData.Modifier) or 0) end for _, trait in ipairs(traits) do local traitData = traitsData and traitsData[trait] if trait == "Sleepy" then sleepy = true elseif type(traitData) == "table" then multiplier = multiplier + (tonumber(traitData.MultiplierModifier) or 0) end end return math.round(base * multiplier * (sleepy and 0.5 or 1)), true end function Data.start() task.spawn(function() local deadline = os.clock() + Config.ModuleWaitSeconds repeat Data.safeRequire("Animals") Data.safeRequire("Mutations") Data.safeRequire("Traits") if Data.modules.Animals and Data.modules.Mutations and Data.modules.Traits then if onDataReady then onDataReady() end return end task.wait(0.1) until os.clock() >= deadline end) end local Normalize = {} function Normalize.machineActive(item) local machine = type(item) == "table" and item.Machine if type(machine) == "table" then return machine.Active == true end return type(machine) == "string" and machine:find('"Active"%s*:%s*true') ~= nil end function Normalize.traits(raw) local list, seen = {}, {} if type(raw) == "table" then for key, value in pairs(raw) do local trait = type(value) == "string" and value or (value == true and type(key) == "string" and key or nil) if trait and not seen[trait] then seen[trait] = true list[#list + 1] = trait end end end table.sort(list) return list end function Normalize.build(name, mutation, traits, owner, source) local tier = TierPolicy.tierOf(name) local generation, complete if tier == "OG" then generation, complete = TierPolicy.OGMoney, true else generation, complete = Data.generation(name, mutation, traits) end if not complete then return nil, false end if generation <= 0 and not tier then return nil, true end local pet = { name = name, gen = generation, mutation = mutation, traits = table.concat(traits, "/"), owner = owner or "", source = source } if not TierPolicy.shouldSend(pet) then return nil, true end return pet, true end function Normalize.fromSyncItem(item, owner) if type(item) ~= "table" or type(item.Index) ~= "string" or item.Index == "" then return nil, true end if Normalize.machineActive(item) then return nil, true end local mutation = item.Mutation ~= nil and tostring(item.Mutation) or "" return Normalize.build(item.Index, mutation, Normalize.traits(item.Traits), owner, "base") end function Normalize.fromModel(model) if not model:IsA("Model") then return nil, true end local mutation, traits, seen = "", {}, {} local function addTrait(value) if value ~= "" and not seen[value] then seen[value] = true traits[#traits + 1] = value end end for _, child in ipairs(model:GetChildren()) do local name = child.Name if mutation == "" and name:sub(1, 9) == "Mutation." then mutation = name:sub(10) else local trait = name:match("^_?Trait%.(.+)$") if trait then addTrait(trait) end end end if mutation == "" then local value = model:GetAttribute("__mutation") or model:GetAttribute("Mutation") mutation = value ~= nil and tostring(value) or "" end local attr = model:GetAttribute("Traits") or model:GetAttribute("Trait") if type(attr) == "string" then for value in attr:gmatch("[^,]+") do addTrait(value:match("^%s*(.-)%s*$")) end end table.sort(traits) return Normalize.build(model.Name, mutation, traits, "", "conveyor") end function Normalize.fromLogical(instance, rawTraits) if typeof(instance) ~= "Instance" or not instance:IsA("Model") then return nil, true end local name = instance:GetAttribute("Index") if type(name) ~= "string" or name == "" then return nil, false end local mutation = instance:GetAttribute("Mutation") return Normalize.build(name, mutation ~= nil and tostring(mutation) or "", Normalize.traits(rawTraits), "", "conveyor") end local Group = {} function Group.selectBest(pets) local best, bestIndex, bestRank = pets[1], 1, TierPolicy.rank[pets[1].tier] or 0 for index = 2, #pets do local rank = TierPolicy.rank[pets[index].tier] or 0 if rank > bestRank then best, bestIndex, bestRank = pets[index], index, rank end end local ordered = { best } for index, pet in ipairs(pets) do if index ~= bestIndex then ordered[#ordered + 1] = pet end end return best, ordered end function Group.bestKey(pet) return pet.name .. "|" .. pet.mutation .. "|" .. pet.tier .. "|" .. tostring(math.floor(pet.gen / 1000000)) end local Payload = {} function Payload.cleanField(value) return (tostring(value or ""):gsub("[,;|\r\n]", " ")) end function Payload.encodePostJData2(pets) local parts = table.create(#pets + 1) local fields = table.create(6) parts[1] = Payload.cleanField(game.JobId) for index, pet in ipairs(pets) do fields[1] = Payload.cleanField(pet.name) fields[2] = tostring(math.floor(pet.gen)) fields[3] = Payload.cleanField(pet.tier) fields[4] = Payload.cleanField(pet.mutation) fields[5] = Payload.cleanField(pet.traits) fields[6] = Payload.cleanField(pet.owner) parts[index + 1] = table.concat(fields, ",") end return "PostJData2||" .. Config.Channel .. "||" .. table.concat(parts, ";") end local Webhook = { colors = { OG = 16766720, PEAK = 16711680, HIGH = 16744192, MID = 10181046, LOW = 65340 }, labels = { OG = "OG", PEAK = "Peaklights", HIGH = "Highlights", MID = "Midlights", LOW = "Lowlights" }, } function Webhook.formatMoney(value) local number = tonumber(value) or 0 if number >= 1e12 then return ("%.2fT"):format(number / 1e12) elseif number >= 1e9 then return ("%.2fB"):format(number / 1e9) elseif number >= 1e6 then return ("%.2fM"):format(number / 1e6) elseif number >= 1e3 then return ("%.2fK"):format(number / 1e3) end return tostring(math.floor(number)) end function Webhook.petName(pet) return (pet.mutation ~= "" and ("[" .. pet.mutation .. "] ") or "") .. tostring(pet.name) end function Webhook.payload(pets) local best = pets[1] local rows = table.create(#pets * 2) local maxName = 0 for index, pet in ipairs(pets) do local name = Webhook.petName(pet) rows[index * 2 - 1] = name rows[index * 2] = "$" .. Webhook.formatMoney(pet.gen) .. "/s" maxName = math.max(maxName, #name) end maxName = math.min(maxName, 34) local lines, used = {}, 0 for index = 1, #pets do local name = rows[index * 2 - 1] local line = name .. string.rep(" ", math.max(1, maxName - #name)) .. " " .. rows[index * 2] if used + #line + 1 > 950 then lines[#lines + 1] = ("... +%d con nua"):format(#pets - index + 1) break end lines[#lines + 1] = line used = used + #line + 1 end local player = cloneRef(Players.LocalPlayer) local allBrainrots = "**🎭 All Brainrots**\n```\n" .. table.concat(lines, "\n") .. "\n```" return { username = "W Notifier | " .. (Webhook.labels[best.tier] or tostring(best.tier)), allowed_mentions = { parse = {} }, embeds = { { title = "🙉 Brainrot Notify", color = Webhook.colors[best.tier] or 65340, fields = { { name = "🏷️ Name", value = "**" .. rows[1] .. "**", inline = true }, { name = "💰 Money per sec", value = "**" .. rows[2] .. "**", inline = true }, { name = "👤 Players", value = "**" .. tostring(player and player.Name or "unknown") .. "**", inline = true }, { name = "\226\128\139", value = allBrainrots, inline = false }, }, footer = { text = "https://discord.gg/wblox • W Notifier • " .. tostring(tick()) }, }, }, } end function Webhook.post(url, payload, timing) local body = HttpService:JSONEncode(payload) local deadline = os.clock() + Config.WebhookMaxWaitSeconds while true do local ok, response = pcall(httpRequest, { Url = url, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = body, }) local code = ok and response and tonumber(response.StatusCode or response.Status) if ok and code and code >= 200 and code < 300 then debugTiming("webhook-sent", timing) return true end if code ~= 429 then debugTiming("webhook-failed", timing) debugLog("webhook status", code or "request error") return false end local retryAfter = 0.8 if response and type(response.Body) == "string" then local decodedOk, decoded = pcall(HttpService.JSONDecode, HttpService, response.Body) if decodedOk and type(decoded) == "table" and tonumber(decoded.retry_after) then retryAfter = tonumber(decoded.retry_after) end end local headers = response and response.Headers if headers and tonumber(headers["retry-after"] or headers["Retry-After"]) then retryAfter = tonumber(headers["retry-after"] or headers["Retry-After"]) end retryAfter = math.clamp(retryAfter, 0.3, 6) + math.random() * 0.6 if os.clock() + retryAfter >= deadline then debugLog("webhook rate-limit deadline reached") return false end task.wait(retryAfter) end end function Webhook.queue(pets, timing, onComplete) local url = Config.WebhookUrls[pets[1].tier] if not validWebhookUrl(url) then debugLog("webhook route missing", pets[1].tier) return false, false end local payloadOk, payload = pcall(Webhook.payload, pets) if not payloadOk then return false, false end local queued = pcall(task.spawn, function() local postOk, delivered = pcall(Webhook.post, url, payload, timing) if onComplete then pcall(onComplete, postOk and delivered == true) end end) if queued then debugTiming("webhook-queued", timing) end return false, queued end local Dispatch = {} function Dispatch.group(pets, eventAt, onComplete) if #pets == 0 then return false, false end Fps.boost(Config.FpsBoostSeconds) local best = pets[1] local timing = Config.Debug and { eventAt = eventAt or os.clock(), detectedAt = os.clock() } or nil debugLog("detect", best.source, best.name, best.tier, math.floor(best.gen), "count=" .. #pets) debugTiming("detect", timing) if Config.Transport == "none" then debugTiming("handled", timing) return true, true end if Config.Transport == "webhook" then return Webhook.queue(pets, timing, function(delivered) if onComplete then pcall(onComplete, delivered) end if delivered then Hop.observeDelivery(pets) end end) end local sent, accepted = LocalWs.send(Payload.encodePostJData2(pets), timing) if sent then Hop.observeDelivery(pets) end return sent, accepted end local BaseDetector = { Synchronizer = nil, channels = setmetatable({}, { __mode = "k" }), resolved = {}, pending = {}, created = {}, hooked = setmetatable({}, { __mode = "k" }), pendingDispatch = setmetatable({}, { __mode = "k" }), lastSignature = setmetatable({}, { __mode = "k" }), lastBest = setmetatable({}, { __mode = "k" }), scratch = {}, plotsRoot = nil, plotsConnection = nil, channelCreatedConnection = nil, channelDestroyedConnection = nil, enumerationAttempted = false, warnedModule = false, warnedCache = false, warnedChanged = false, } function BaseDetector.getSynchronizer() if BaseDetector.Synchronizer then return BaseDetector.Synchronizer end local packages = ReplicatedStorage:FindFirstChild("Packages") local module = packages and cloneRef(packages:FindFirstChild("Synchronizer")) if not module then if not BaseDetector.warnedModule then BaseDetector.warnedModule = true warn("[scanner_fast] Synchronizer unavailable; base detection will retry") end return nil end local ok, value = pcall(require, module) if ok and type(value) == "table" and type(value.GetTableFromChannel) == "function" then BaseDetector.Synchronizer = value return value end if not BaseDetector.warnedModule then BaseDetector.warnedModule = true warn("[scanner_fast] Synchronizer unavailable; base detection will retry") end return nil end function BaseDetector.patchRelateChannels() if type(filtergc) ~= "function" or type(debug) ~= "table" or type(debug.info) ~= "function" or type(debug.getconstants) ~= "function" or type(debug.setconstant) ~= "function" or type(debug.getupvalue) ~= "function" or type(debug.setupvalue) ~= "function" then return false end local ok, patched = pcall(function() local functions = filtergc("function", { Name = "RelateChannels" }, false) if type(functions) == "function" then functions = { functions } elseif type(functions) ~= "table" then return false end local replacements = { ["ReplicatedStorage.Packages.Synchronizer"] = { "[C]", "[JACKY]" }, ["ReplicatedStorage.Shared.Animals"] = { "writefile", "jackywashere" }, } local matched = {} for _, fn in pairs(functions) do if type(fn) == "function" then local source = tostring(debug.info(fn, "s")):gsub("%s+$", "") local replacement = replacements[source] if replacement then local constants = debug.getconstants(fn) for index = 1, rawlen(constants) do local value = rawget(constants, index) if value == replacement[1] or value == replacement[2] then if matched[source] then return false end matched[source] = true if value ~= replacement[2] then debug.setconstant(fn, index, replacement[2]) if rawget(debug.getconstants(fn), index) ~= replacement[2] then return false end end if source == "ReplicatedStorage.Packages.Synchronizer" then local serverFlag = debug.getupvalue(fn, 1) local detectionLatch = debug.getupvalue(fn, 2) local guid = debug.getupvalue(fn, 4) if type(serverFlag) ~= "boolean" or detectionLatch ~= nil and type(detectionLatch) ~= "boolean" or type(guid) ~= "string" or #guid ~= 36 then return false end debug.setupvalue(fn, 1, true) if debug.getupvalue(fn, 1) ~= true then return false end end end end end end end return matched["ReplicatedStorage.Packages.Synchronizer"] == true and matched["ReplicatedStorage.Shared.Animals"] == true end) return ok and patched == true end function BaseDetector.rawCandidate(item) if type(item) ~= "table" or type(item.Index) ~= "string" or item.Index == "" then return false, true end if TierPolicy.tierOf(item.Index) then return true, true end local animals = Data.safeRequire("Animals") if not animals then return false, false end return animals[item.Index] ~= nil, true end function BaseDetector.scanChannel(channel, eventAt) eventAt = eventAt or os.clock() local cache = type(channel) == "table" and channel.CacheTable local list = cache and cache.AnimalList if type(list) ~= "table" then return end local owner = cache.Owner owner = typeof(owner) == "Instance" and owner.Name or tostring(owner or "") local count, candidates = 0, {} for _, item in pairs(list) do local candidate, ready = BaseDetector.rawCandidate(item) if not ready then return end if candidate then count = count + 1 candidates[#candidates + 1] = item local traits = Normalize.traits(item.Traits) BaseDetector.scratch[count] = table.concat({ tostring(item.Index), tostring(item.Mutation or ""), table.concat(traits, "/"), Normalize.machineActive(item) and "1" or "0" }, "\1") end end for index = count + 1, #BaseDetector.scratch do BaseDetector.scratch[index] = nil end if count == 0 then BaseDetector.pendingDispatch[channel] = nil BaseDetector.lastSignature[channel] = nil BaseDetector.lastBest[channel] = nil return end table.sort(BaseDetector.scratch) local signature = owner .. "#" .. table.concat(BaseDetector.scratch, "|", 1, count) local pending = BaseDetector.pendingDispatch[channel] if BaseDetector.lastSignature[channel] == signature then if pending and pending.signature ~= signature then BaseDetector.pendingDispatch[channel] = nil end return end local passing = {} for _, item in ipairs(candidates) do local pet, complete = Normalize.fromSyncItem(item, owner) if not complete then return end if pet then passing[#passing + 1] = pet end end if #passing == 0 then BaseDetector.pendingDispatch[channel] = nil BaseDetector.lastSignature[channel] = signature BaseDetector.lastBest[channel] = nil return end local best, ordered = Group.selectBest(passing) local bestKey = Group.bestKey(best) pending = BaseDetector.pendingDispatch[channel] if pending and (pending.signature ~= signature or pending.bestKey ~= bestKey) then BaseDetector.pendingDispatch[channel] = nil pending = nil end if BaseDetector.lastBest[channel] == bestKey then BaseDetector.lastSignature[channel] = signature return end if pending then return end local token if Config.Transport == "webhook" then token = { bestKey = bestKey, signature = signature } BaseDetector.pendingDispatch[channel] = token end local sent, accepted = Dispatch.group(ordered, eventAt, function(delivered) if BaseDetector.pendingDispatch[channel] ~= token then return end BaseDetector.pendingDispatch[channel] = nil if delivered and BaseDetector.isCurrent(channel) then BaseDetector.lastSignature[channel] = signature BaseDetector.lastBest[channel] = bestKey end end) if sent then BaseDetector.pendingDispatch[channel] = nil BaseDetector.lastSignature[channel] = signature BaseDetector.lastBest[channel] = bestKey elseif token and not accepted and BaseDetector.pendingDispatch[channel] == token then BaseDetector.pendingDispatch[channel] = nil end end function BaseDetector.isCurrent(channel) local plot = BaseDetector.channels[channel] if not plot then return false end local record = BaseDetector.resolved[plot.Name] return Workspace:FindFirstChild("Plots") == BaseDetector.plotsRoot and plot.Parent == BaseDetector.plotsRoot and record ~= nil and record.plot == plot and record.channel == channel end function BaseDetector.clearChannel(channel) BaseDetector.channels[channel] = nil BaseDetector.lastSignature[channel] = nil BaseDetector.lastBest[channel] = nil BaseDetector.pendingDispatch[channel] = nil end function BaseDetector.hookChannel(channel) if not BaseDetector.isCurrent(channel) then return end BaseDetector.scanChannel(channel, os.clock()) local eventChannel = channel.EventChannel if type(eventChannel) ~= "table" or BaseDetector.hooked[eventChannel] or type(eventChannel.OnChanged) ~= "function" then return end local ok = pcall(function() eventChannel:OnChanged("AnimalList", function() local eventAt = os.clock() if not BaseDetector.isCurrent(channel) or channel.EventChannel ~= eventChannel then return end if type(eventChannel.CacheTable) == "table" then channel.CacheTable = eventChannel.CacheTable end BaseDetector.scanChannel(channel, eventAt) end) end) if ok then BaseDetector.hooked[eventChannel] = true elseif not BaseDetector.warnedChanged then BaseDetector.warnedChanged = true warn("[scanner_fast] AnimalList listener unavailable; exact-cache polling remains active") end end function BaseDetector.registerPlot(plot) BaseDetector.pending[plot.Name] = plot end function BaseDetector.tryResolve(plot, eventChannel) local synchronizer = BaseDetector.getSynchronizer() if not synchronizer or not plot or plot.Parent ~= BaseDetector.plotsRoot then return false end eventChannel = eventChannel or BaseDetector.created[plot.Name] local ok, cache = pcall(synchronizer.GetTableFromChannel, synchronizer, plot.Name) if type(eventChannel) == "table" and tostring(eventChannel.Index) == plot.Name and type(eventChannel.CacheTable) == "table" then cache = eventChannel.CacheTable ok = true end if not ok or type(cache) ~= "table" then if not BaseDetector.warnedCache then BaseDetector.warnedCache = true warn("[scanner_fast] exact plot cache unavailable; base detection will retry") end return false end local previous = BaseDetector.resolved[plot.Name] local channel = previous and previous.plot == plot and previous.channel or nil if not channel then if previous then BaseDetector.clearChannel(previous.channel) end channel = { Index = plot.Name } BaseDetector.lastSignature[channel] = nil BaseDetector.lastBest[channel] = nil BaseDetector.resolved[plot.Name] = { plot = plot, channel = channel } BaseDetector.channels[channel] = plot debugLog("base channel resolved", plot.Name) end channel.CacheTable = cache if type(eventChannel) == "table" and tostring(eventChannel.Index) == plot.Name then channel.EventChannel = eventChannel end BaseDetector.pending[plot.Name] = nil BaseDetector.hookChannel(channel) return true end function BaseDetector.hookPlots(root) if BaseDetector.plotsRoot == root then return end if BaseDetector.plotsConnection then BaseDetector.plotsConnection:Disconnect() end BaseDetector.plotsRoot = root BaseDetector.channels = setmetatable({}, { __mode = "k" }) BaseDetector.lastSignature = setmetatable({}, { __mode = "k" }) BaseDetector.lastBest = setmetatable({}, { __mode = "k" }) BaseDetector.resolved = {} BaseDetector.pending = {} BaseDetector.plotsConnection = root.ChildAdded:Connect(function(plot) BaseDetector.registerPlot(plot) if BaseDetector.tryResolve(plot) then return end task.spawn(function() local deadline = os.clock() + 1.2 repeat task.wait() until BaseDetector.tryResolve(plot) or plot.Parent ~= root or os.clock() >= deadline end) end) BaseDetector.enumerateExistingChannels() for _, plot in ipairs(root:GetChildren()) do BaseDetector.registerPlot(plot) BaseDetector.tryResolve(plot) end end function BaseDetector.enumerateExistingChannels() if not Config.UnsafeGetAllChannels or BaseDetector.enumerationAttempted then return end local root = BaseDetector.plotsRoot if not root then return end BaseDetector.enumerationAttempted = true local synchronizer = BaseDetector.getSynchronizer() if not synchronizer or type(synchronizer.GetAllChannels) ~= "function" then warn("[scanner_fast] GetAllChannels unavailable; exact-cache fallback remains active") return end if not BaseDetector.patchRelateChannels() then warn("[scanner_fast] RelateChannels patch failed; GetAllChannels skipped") return end local ok, channels = pcall(synchronizer.GetAllChannels, synchronizer) if not ok or type(channels) ~= "table" then warn("[scanner_fast] GetAllChannels failed; exact-cache fallback remains active") return end local hooked = 0 for index, eventChannel in pairs(channels) do if type(eventChannel) == "table" and type(eventChannel.CacheTable) == "table" then local channelIndex = eventChannel.Index ~= nil and tostring(eventChannel.Index) or tostring(index) local plot = root:FindFirstChild(channelIndex) if plot then BaseDetector.created[channelIndex] = eventChannel if BaseDetector.tryResolve(plot, eventChannel) then hooked = hooked + 1 end end end end debugLog("GetAllChannels one-shot", hooked, "plot channels hooked") end function BaseDetector.hookCreatedChannels() local synchronizer = BaseDetector.getSynchronizer() if not synchronizer then return end if not BaseDetector.channelCreatedConnection and synchronizer.OnChannelCreated then local ok, connection = pcall(function() return synchronizer.OnChannelCreated:Connect(function(channel) if type(channel) ~= "table" or channel.Index == nil then return end local index = tostring(channel.Index) BaseDetector.created[index] = channel local root = BaseDetector.plotsRoot local plot = root and root:FindFirstChild(index) if plot then BaseDetector.tryResolve(plot, channel) end end) end) if ok then BaseDetector.channelCreatedConnection = connection end end if not BaseDetector.channelDestroyedConnection and synchronizer.OnChannelDestroyed then local ok, connection = pcall(function() return synchronizer.OnChannelDestroyed:Connect(function(channel) if type(channel) ~= "table" or channel.Index == nil then return end local index = tostring(channel.Index) if BaseDetector.created[index] == channel then BaseDetector.created[index] = nil end local record = BaseDetector.resolved[index] if record and record.channel.EventChannel == channel then BaseDetector.clearChannel(record.channel) BaseDetector.resolved[index] = nil BaseDetector.pending[index] = record.plot end end) end) if ok then BaseDetector.channelDestroyedConnection = connection end end BaseDetector.enumerateExistingChannels() end function BaseDetector.poll() BaseDetector.hookCreatedChannels() local root = Workspace:FindFirstChild("Plots") if root and root ~= BaseDetector.plotsRoot then BaseDetector.hookPlots(root) end for name, record in pairs(BaseDetector.resolved) do if record.plot.Parent ~= BaseDetector.plotsRoot then BaseDetector.clearChannel(record.channel) BaseDetector.resolved[name] = nil BaseDetector.pending[name] = record.plot elseif not record.channel.EventChannel then BaseDetector.tryResolve(record.plot) end end for name, plot in pairs(BaseDetector.pending) do if plot.Parent == BaseDetector.plotsRoot then BaseDetector.tryResolve(plot) else BaseDetector.pending[name] = nil end end end function BaseDetector.start() BaseDetector.hookCreatedChannels() Workspace.ChildAdded:Connect(function(child) if child.Name == "Plots" then BaseDetector.hookPlots(child) end end) task.spawn(function() local deadline = os.clock() + Config.PlotsWaitSeconds repeat local root = Workspace:FindFirstChild("Plots") if root then task.wait(Config.JoinSettleSeconds) BaseDetector.hookPlots(root) break end task.wait(0.03) until os.clock() >= deadline while true do task.wait(Config.SyncPollSeconds) BaseDetector.poll() end end) end local rescheduleVisualFallback local LogicalDetector = { active = false, starting = false, controller = nil, traitRep = nil, token = nil, tagConnection = nil, spawnConnection = nil, destroyConnection = nil, records = {}, byVisual = setmetatable({}, { __mode = "k" }), warnedSetup = false, } function LogicalDetector.disconnect(connection) if connection then pcall(function() connection:Disconnect() end) end end function LogicalDetector.stopWatch(record) for _, connection in ipairs(record.connections or {}) do LogicalDetector.disconnect(connection) end record.connections = {} local cleanup = record.traitCleanup record.traitCleanup = nil if type(cleanup) == "function" then pcall(cleanup) else LogicalDetector.disconnect(cleanup) end end function LogicalDetector.clear(uid) if uid == nil then return end local record = LogicalDetector.records[uid] if not record then return end LogicalDetector.records[uid] = nil LogicalDetector.stopWatch(record) local visual = record.visual if visual then LogicalDetector.byVisual[visual] = nil if record.state ~= "delivered" and record.state ~= "dispatching" and rescheduleVisualFallback then rescheduleVisualFallback(visual, record.eventAt) end end end function LogicalDetector.reset() LogicalDetector.active = false LogicalDetector.token = nil LogicalDetector.disconnect(LogicalDetector.tagConnection) LogicalDetector.disconnect(LogicalDetector.spawnConnection) LogicalDetector.disconnect(LogicalDetector.destroyConnection) LogicalDetector.tagConnection = nil LogicalDetector.spawnConnection = nil LogicalDetector.destroyConnection = nil local uid = next(LogicalDetector.records) while uid do LogicalDetector.clear(uid) uid = next(LogicalDetector.records) end LogicalDetector.controller = nil LogicalDetector.traitRep = nil LogicalDetector.byVisual = setmetatable({}, { __mode = "k" }) end function LogicalDetector.isCurrent(record) if not LogicalDetector.active or LogicalDetector.records[record.uid] ~= record or typeof(record.instance) ~= "Instance" then return false end if record.fromSpawn then return true end local ok, tagged = pcall(CollectionService.HasTag, CollectionService, record.instance, "Animal") return ok and tagged == true end function LogicalDetector.rawTraits(record) local traitRep = LogicalDetector.traitRep if not traitRep then return nil, false end local ok, raw = pcall(traitRep.TryIndex, traitRep, { "traits", record.uid }) if not ok then return nil, false end return type(raw) == "table" and raw or {}, true end function LogicalDetector.evaluate(record) if not LogicalDetector.isCurrent(record) then LogicalDetector.clear(record.uid) return true end if record.state == "delivered" or record.state == "dispatching" then return true end local rawTraits, traitsReady = LogicalDetector.rawTraits(record) if not traitsReady then return false end local pet, complete = Normalize.fromLogical(record.instance, rawTraits) if not complete then return false end if Config.Debug and not record.spawnLogged then record.spawnLogged = true local name = record.instance:GetAttribute("Index") local mutation = record.instance:GetAttribute("Mutation") local traits = Normalize.traits(rawTraits) local uid = record.uid debugLog( "animal spawn", "uid=..." .. uid:sub(-8), "name=" .. tostring(name or "unknown"), "mutation=" .. tostring(mutation or "none"), "traits=" .. (#traits > 0 and table.concat(traits, "/") or "none"), "tier=" .. tostring((pet and pet.tier) or TierPolicy.tierOf(name) or "filtered"), "gen=" .. tostring(pet and math.floor(pet.gen) or "filtered") ) end if not pet then record.state = "filtered" return true end local token if Config.Transport == "webhook" then token = {} record.dispatchToken = token record.state = "dispatching" end local sent, accepted = Dispatch.group({ pet }, record.eventAt, function(delivered) if LogicalDetector.records[record.uid] ~= record or record.dispatchToken ~= token then return end record.dispatchToken = nil record.state = delivered and "delivered" or "waiting" if delivered then LogicalDetector.stopWatch(record) end end) if sent then record.dispatchToken = nil record.state = "delivered" LogicalDetector.stopWatch(record) return true end if token and accepted then return true end if record.dispatchToken == token then record.dispatchToken = nil end record.state = "waiting" return false end function LogicalDetector.schedule(record, immediate) if not LogicalDetector.isCurrent(record) or record.scheduled or record.state == "delivered" or record.state == "dispatching" then return end record.scheduled = true local name = record.instance:GetAttribute("Index") local delay = immediate and 0 or (TierPolicy.tierOf(name) == "OG" and 0 or Config.ConveyorDelay) task.spawn(function() if delay > 0 then task.wait(delay) end if not LogicalDetector.evaluate(record) and LogicalDetector.isCurrent(record) then record.state = "waiting" end if LogicalDetector.records[record.uid] == record then record.scheduled = false end end) end function LogicalDetector.wake(record) if not LogicalDetector.isCurrent(record) or record.state == "delivered" or record.state == "dispatching" then return end record.state = nil LogicalDetector.schedule(record, true) end function LogicalDetector.track(instance, eventAt, fromSpawn, uidOverride) if not LogicalDetector.active or typeof(instance) ~= "Instance" or not instance:IsA("Model") then return nil end local uid = uidOverride or instance.Name if uid == "" then return nil end local previous = LogicalDetector.records[uid] if not previous then for _, candidate in pairs(LogicalDetector.records) do if candidate.instance == instance then previous = candidate break end end end if previous then if previous.instance == instance then if fromSpawn then previous.fromSpawn = true end return previous end LogicalDetector.clear(uid) end local record = { uid = uid, instance = instance, eventAt = eventAt or os.clock(), fromSpawn = fromSpawn == true, connections = {} } LogicalDetector.records[uid] = record for _, attribute in ipairs({ "Index", "Mutation" }) do local ok, connection = pcall(function() return instance:GetAttributeChangedSignal(attribute):Connect(function() LogicalDetector.wake(record) end) end) if ok and connection then record.connections[#record.connections + 1] = connection end end LogicalDetector.schedule(record, false) if TierPolicy.tierOf(instance:GetAttribute("Index")) ~= "OG" then local ok, cleanup = pcall(function() return LogicalDetector.traitRep:Observe({ "traits", uid }, function() LogicalDetector.wake(record) end) end) if not ok or cleanup == nil then LogicalDetector.clear(uid) return end record.traitCleanup = cleanup end return record end function LogicalDetector.bindAnimal(animal, eventAt) if not LogicalDetector.active or type(animal) ~= "table" then return end local instance = animal.Instance local instanceUid = typeof(instance) == "Instance" and instance.Name or nil local uid = animal.UID or instanceUid local record = (uid and LogicalDetector.records[uid]) or (instanceUid and LogicalDetector.records[instanceUid]) if not record and eventAt and typeof(instance) == "Instance" then record = LogicalDetector.track(instance, eventAt, true, uid) elseif record and eventAt then record.fromSpawn = true end if not record then return end record.animal = animal local visual = animal.AnimalModel if typeof(visual) == "Instance" then record.visual = visual LogicalDetector.byVisual[visual] = record end if eventAt then LogicalDetector.wake(record) end end function LogicalDetector.ownsModel(model) if not LogicalDetector.active then return false end local record = LogicalDetector.byVisual[model] if record then if LogicalDetector.isCurrent(record) then return true end LogicalDetector.byVisual[model] = nil end for _, candidate in pairs(LogicalDetector.records) do local animal = candidate.animal if type(animal) == "table" and animal.AnimalModel == model and LogicalDetector.isCurrent(candidate) then candidate.visual = model LogicalDetector.byVisual[model] = candidate return true end end local controller = LogicalDetector.controller if not controller or type(controller.GetAnimals) ~= "function" then return false end local ok, animals = pcall(controller.GetAnimals, controller) if not ok or type(animals) ~= "table" then return false end for _, animal in pairs(animals) do if type(animal) == "table" and animal.AnimalModel == model then LogicalDetector.bindAnimal(animal) return LogicalDetector.byVisual[model] ~= nil end end return false end function LogicalDetector.retryPending() if not LogicalDetector.active then return end for _, record in pairs(LogicalDetector.records) do if record.state == "waiting" then record.state = nil LogicalDetector.schedule(record, true) end end end function LogicalDetector.loadCapabilities() local controllers = ReplicatedStorage:FindFirstChild("Controllers") local packages = ReplicatedStorage:FindFirstChild("Packages") local controllerModule = controllers and cloneRef(controllers:FindFirstChild("AnimalController")) local replicatorModule = packages and cloneRef(packages:FindFirstChild("ReplicatorClient")) if not controllerModule or not replicatorModule then error("logical modules unavailable") end local controller = require(controllerModule) local replicator = require(replicatorModule) if type(replicator) ~= "table" or type(replicator.get) ~= "function" then error("logical replicator unavailable") end return controller, replicator.get("AnimalTraits") end function LogicalDetector.tryStart(deadline) if LogicalDetector.active then return true end local attempt = { valid = true, done = false } local loadThread = task.spawn(function() local ok, controller, traitRep = pcall(LogicalDetector.loadCapabilities) if not attempt.valid or os.clock() >= deadline then return end attempt.ok = ok attempt.controller = controller attempt.traitRep = traitRep attempt.done = true end) while not attempt.done and os.clock() < deadline do task.wait(math.min(0.03, math.max(0, deadline - os.clock()))) end attempt.valid = false if not attempt.done then pcall(task.cancel, loadThread) return false end local controller, traitRep = attempt.controller, attempt.traitRep if not attempt.ok or os.clock() >= deadline or type(controller) ~= "table" or type(traitRep) ~= "table" or type(traitRep.TryIndex) ~= "function" or type(traitRep.Observe) ~= "function" or type(controller.GetAnimals) ~= "function" or not controller.OnAnimalSpawn or type(controller.OnAnimalSpawn.Connect) ~= "function" or not controller.OnAnimalDestroyed or type(controller.OnAnimalDestroyed.Connect) ~= "function" then return false end local token = {} LogicalDetector.controller = controller LogicalDetector.traitRep = traitRep LogicalDetector.token = token LogicalDetector.active = true local connected = pcall(function() LogicalDetector.tagConnection = CollectionService:GetInstanceAddedSignal("Animal"):Connect(function(instance) if LogicalDetector.token == token then pcall(LogicalDetector.track, instance, os.clock()) end end) LogicalDetector.spawnConnection = controller.OnAnimalSpawn:Connect(function(animal) if LogicalDetector.token == token then pcall(LogicalDetector.bindAnimal, animal, os.clock()) end end) LogicalDetector.destroyConnection = controller.OnAnimalDestroyed:Connect(function(uid) if LogicalDetector.token == token then LogicalDetector.clear(uid) end end) end) if not connected or not LogicalDetector.tagConnection or not LogicalDetector.spawnConnection or not LogicalDetector.destroyConnection then LogicalDetector.reset() return false end debugLog("conveyor logical source connected") return true end function LogicalDetector.start() if LogicalDetector.active or LogicalDetector.starting then return end LogicalDetector.starting = true local deadline = os.clock() + Config.ModuleWaitSeconds task.spawn(function() while os.clock() < deadline do if LogicalDetector.tryStart(deadline) then LogicalDetector.starting = false return end local remaining = deadline - os.clock() if remaining > 0 then task.wait(math.min(0.1, remaining)) end end LogicalDetector.starting = false if not LogicalDetector.warnedSetup then LogicalDetector.warnedSetup = true warn("[scanner_fast] logical conveyor unavailable; rendered fallback remains active") end end) end local ConveyorDetector = { root = nil, connection = nil, scheduled = setmetatable({}, { __mode = "k" }), waiting = setmetatable({}, { __mode = "k" }), dispatching = setmetatable({}, { __mode = "k" }), seen = setmetatable({}, { __mode = "k" }), watchers = setmetatable({}, { __mode = "k" }), } function ConveyorDetector.isCurrent(root, model) return ConveyorDetector.root == root and root.Parent == Workspace and root.Name == "RenderedMovingAnimals" and model:IsA("Model") and model.Parent == root end function ConveyorDetector.clearWatch(model) local record = ConveyorDetector.watchers[model] if not record then return end ConveyorDetector.watchers[model] = nil for _, connection in ipairs(record.connections) do pcall(function() connection:Disconnect() end) end end function ConveyorDetector.clearWatches() for model in pairs(ConveyorDetector.watchers) do ConveyorDetector.clearWatch(model) end end function ConveyorDetector.watchModel(root, model, eventAt) if ConveyorDetector.watchers[model] then return end local record = { connections = {} } ConveyorDetector.watchers[model] = record local function connect(signal, callback) local ok, connection = pcall(function() return signal:Connect(callback) end) if ok then record.connections[#record.connections + 1] = connection end end local function wake() if not ConveyorDetector.isCurrent(root, model) then ConveyorDetector.clearWatch(model) return end if ConveyorDetector.dispatching[model] or ConveyorDetector.seen[model] == "delivered" then return end if ConveyorDetector.seen[model] == "filtered" then ConveyorDetector.seen[model] = nil end ConveyorDetector.waiting[model] = nil ConveyorDetector.schedule(root, model, eventAt, true) end connect(model.ChildAdded, function(child) local name = child.Name if name:sub(1, 9) == "Mutation." or name:match("^_?Trait%.") then wake() end end) for _, attribute in ipairs({ "__mutation", "Mutation", "Traits", "Trait" }) do connect(model:GetAttributeChangedSignal(attribute), wake) end connect(model.AncestryChanged, function() if not ConveyorDetector.isCurrent(root, model) then ConveyorDetector.clearWatch(model) end end) end function ConveyorDetector.evaluate(root, model, eventAt) if not ConveyorDetector.isCurrent(root, model) then return true end if LogicalDetector.ownsModel(model) then ConveyorDetector.seen[model] = "logical" ConveyorDetector.clearWatch(model) return true end if ConveyorDetector.seen[model] or ConveyorDetector.dispatching[model] then return true end local pet, complete = Normalize.fromModel(model) if not complete then return false end if not pet then ConveyorDetector.seen[model] = "filtered" return true end local token if Config.Transport == "webhook" then token = {} ConveyorDetector.dispatching[model] = token end local sent, accepted = Dispatch.group({ pet }, eventAt, function(delivered) if ConveyorDetector.dispatching[model] ~= token then return end ConveyorDetector.dispatching[model] = nil if delivered and ConveyorDetector.isCurrent(root, model) then ConveyorDetector.seen[model] = "delivered" ConveyorDetector.clearWatch(model) elseif ConveyorDetector.isCurrent(root, model) then ConveyorDetector.waiting[model] = eventAt else ConveyorDetector.clearWatch(model) end end) if sent then ConveyorDetector.dispatching[model] = nil ConveyorDetector.seen[model] = "delivered" ConveyorDetector.clearWatch(model) return true end if token and accepted then return true end if ConveyorDetector.dispatching[model] == token then ConveyorDetector.dispatching[model] = nil end return false end function ConveyorDetector.retryPending() local root = ConveyorDetector.root if not root then return end local pending = {} for model, eventAt in pairs(ConveyorDetector.waiting) do ConveyorDetector.waiting[model] = nil pending[#pending + 1] = { model, eventAt } end for _, entry in ipairs(pending) do local model, eventAt = entry[1], entry[2] if not ConveyorDetector.evaluate(root, model, eventAt) and ConveyorDetector.isCurrent(root, model) then ConveyorDetector.waiting[model] = eventAt end end end function ConveyorDetector.schedule(root, model, eventAt, immediate) if not ConveyorDetector.isCurrent(root, model) or ConveyorDetector.scheduled[model] == root or ConveyorDetector.waiting[model] or ConveyorDetector.seen[model] then return end eventAt = eventAt or os.clock() if LogicalDetector.ownsModel(model) then ConveyorDetector.seen[model] = "logical" return end ConveyorDetector.watchModel(root, model, eventAt) ConveyorDetector.scheduled[model] = root local delay = immediate and 0 or ((LogicalDetector.active or TierPolicy.tierOf(model.Name) ~= "OG") and Config.ConveyorDelay or 0) task.spawn(function() if delay > 0 then task.wait(delay) end if not ConveyorDetector.evaluate(root, model, eventAt) and ConveyorDetector.isCurrent(root, model) then ConveyorDetector.waiting[model] = eventAt end if ConveyorDetector.scheduled[model] == root then ConveyorDetector.scheduled[model] = nil end end) end rescheduleVisualFallback = function(model, eventAt) task.defer(function() local root = ConveyorDetector.root if ConveyorDetector.seen[model] ~= "logical" or not root or not ConveyorDetector.isCurrent(root, model) then return end ConveyorDetector.seen[model] = nil ConveyorDetector.schedule(root, model, eventAt, true) end) end function ConveyorDetector.hookRoot(root) if ConveyorDetector.root == root then return end if ConveyorDetector.connection then ConveyorDetector.connection:Disconnect() end ConveyorDetector.clearWatches() ConveyorDetector.root = root ConveyorDetector.connection = root.ChildAdded:Connect(function(model) local eventAt = os.clock() if not LogicalDetector.active then ConveyorDetector.schedule(root, model, eventAt) return end task.defer(function() if ConveyorDetector.isCurrent(root, model) then ConveyorDetector.schedule(root, model, eventAt) end end) end) local children = root:GetChildren() debugLog("conveyor root connected", #children) for _, model in ipairs(children) do ConveyorDetector.schedule(root, model) end ConveyorDetector.retryPending() end function ConveyorDetector.start() Workspace.ChildAdded:Connect(function(child) if child.Name == "RenderedMovingAnimals" then ConveyorDetector.hookRoot(child) end end) local root = Workspace:FindFirstChild("RenderedMovingAnimals") if root then ConveyorDetector.hookRoot(root) end task.spawn(function() while true do task.wait(Config.ConveyorRetryDelay) LogicalDetector.retryPending() ConveyorDetector.retryPending() end end) end onDataReady = function() if Config.BaseEnabled then BaseDetector.poll() end LogicalDetector.retryPending() ConveyorDetector.retryPending() end onSocketConnected = function() if Config.BaseEnabled then BaseDetector.poll() -- rescan cached bases immediately instead of waiting SyncPollSeconds end LogicalDetector.retryPending() ConveyorDetector.retryPending() local root = ConveyorDetector.root if not root or root.Parent ~= Workspace or root.Name ~= "RenderedMovingAnimals" then return end for _, model in ipairs(root:GetChildren()) do ConveyorDetector.schedule(root, model) end end Fps.start() Data.start() if Config.BaseEnabled then BaseDetector.start() else debugLog("base Synchronizer disabled") end ConveyorDetector.start() LogicalDetector.start() task.defer(Hop.start) Players.PlayerAdded:Connect(function() Fps.boost(Config.PlayerJoinBoostSeconds) end)