Skip to content

Instantly share code, notes, and snippets.

@DuyNgao2306
Created May 18, 2026 23:12
Show Gist options
  • Select an option

  • Save DuyNgao2306/f0cb36a614573c7235a8b04f1b3e229c to your computer and use it in GitHub Desktop.

Select an option

Save DuyNgao2306/f0cb36a614573c7235a8b04f1b3e229c to your computer and use it in GitHub Desktop.
// ===== CONFIG =====
const SCRIPT_URL = "https://gist.githubusercontent.com/DuyNgao2306/4d863d2d44f0f315d753cb067a1afa3a/raw/9db178822c1dfc71454b024f3b13f2b93620870a/Fix_Lag.lua";
// ===== AUTO UPDATE =====
let currentVersion = null;
let currentScript = null;
async function updateScript() {
try {
const res = await fetch(SCRIPT_URL + "?t=" + Date.now());
const code = await res.text();
// lấy version
const match = code.match(/@version\s+([^\n]+)/);
const newVersion = match ? match[1] : code.length;
if (newVersion === currentVersion) return;
console.log("🔄 Update script:", newVersion);
// destroy script cũ
if (currentScript && typeof currentScript.destroy === "function") {
try { currentScript.destroy(); } catch (e) {}
}
// chạy script mới
const module = { exports: {} };
new Function("module", "exports", code)(module, module.exports);
currentScript = module.exports;
currentVersion = newVersion;
// init script mới
if (currentScript && typeof currentScript.init === "function") {
currentScript.init();
}
} catch (err) {
console.error("❌ Load lỗi:", err);
}
}
// chạy lần đầu + loop
updateScript();
setInterval(updateScript, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment