--!strict local CACHE_DIR = "DeltaCustomizationCache" local CACHE_FILE = CACHE_DIR .. "/DeltaCustomizationModule.luau" local REMOTE_URL = "https://gitlab.com/ltseverydayyou/uuuuuuu/-/raw/main/DeltaCustomizationModule.luau" local CHUNK_NAME = "@DeltaCustomizationModule.luau" local fs = { readFile = (type(readfile) == "function" and readfile) or nil, writeFile = (type(writefile) == "function" and writefile) or nil, isFile = (type(isfile) == "function" and isfile) or nil, isFolder = (type(isfolder) == "function" and isfolder) or nil, makeFolder = (type(makefolder) == "function" and makefolder) or nil, } local http_req = (type(request) == "function" and request) or (type(http_request) == "function" and http_request) or (type(syn) == "table" and type(syn.request) == "function" and syn.request) or nil local function getExecutorName(): string if type(identifyexecutor) == "function" then local ok, name = pcall(identifyexecutor) if ok and type(name) == "string" then return name:lower() end end return "unknown" end local function ensureDirectory(): boolean if not fs.makeFolder then return false end if fs.isFolder then local ok, exists = pcall(fs.isFolder, CACHE_DIR) if ok and exists then return true end end return pcall(fs.makeFolder, CACHE_DIR) end local function loadFromDisk(): string? if not fs.readFile then return nil end if fs.isFile then local okExists, exists = pcall(fs.isFile, CACHE_FILE) if not (okExists and exists) then return nil end end local okRead, content = pcall(fs.readFile, CACHE_FILE) if okRead and type(content) == "string" and #content > 0 then return content end return nil end local function saveToDisk(content: string): boolean if not fs.writeFile then return false end ensureDirectory() return pcall(fs.writeFile, CACHE_FILE, content) end local function fetchRemoteSource(): (boolean, string?) if http_req then local ok, res = pcall(http_req, { Url = REMOTE_URL, Method = "GET", Headers = { ["User-Agent"] = "DeltaLoader/2.0", ["Cache-Control"] = "no-cache", }, }) if ok and type(res) == "table" and res.StatusCode == 200 and type(res.Body) == "string" and #res.Body > 0 then return true, res.Body end end local okGet, body = pcall(game.HttpGet, game, REMOTE_URL) if okGet and type(body) == "string" and #body > 0 then return true, body end return false, nil end local function executePayload(source: string): (boolean, string?) local chunk, compileErr = loadstring(source, CHUNK_NAME) if not chunk then return false, "Compilation failed: " .. tostring(compileErr) end local success, runtimeErr = xpcall(chunk, debug.traceback) if not success then return false, "Runtime error: " .. tostring(runtimeErr) end return true, nil end local function checkAndUpdateCache(currentSource: string?) task.spawn(function() local fetchOk, remoteSource = fetchRemoteSource() if not (fetchOk and remoteSource) then return end if currentSource and remoteSource == currentSource then return end local testCompile, syntaxErr = loadstring(remoteSource, CHUNK_NAME) if not testCompile then warn("[DeltaLoader] Staged update dropped due to syntax error: " .. tostring(syntaxErr)) return end if saveToDisk(remoteSource) then print("[DeltaLoader] Local cache successfully updated for next launch.") end end) end local function boot() local execName = getExecutorName() if not execName:find("delta") then warn("[DeltaLoader] Warning: Active executor is '" .. execName .. "'. Target module requires Delta.") end local cachedSource = loadFromDisk() if cachedSource then local ok, err = executePayload(cachedSource) if ok then checkAndUpdateCache(cachedSource) return else warn("[DeltaLoader] Cached payload failed to run. Falling back to fresh download: " .. tostring(err)) end end local fetchOk, remoteSource = fetchRemoteSource() assert(fetchOk and remoteSource, "[DeltaLoader] Fatal: Unable to retrieve remote script and no cache is present.") local ok, err = executePayload(remoteSource) if ok then saveToDisk(remoteSource) else error("[DeltaLoader] Fatal execution failure: " .. tostring(err)) end end boot()