Loading... Getting Roblox ready!
{ const loadingScreen = document.getElementById("loading-screen"); const loadingProgress = document.getElementById("loading-progress"); const mainContent = document.getElementById("main-content"); // Get all images and other assets in the document to track loading const resources = [...document.images]; const totalResources = resources.length; let loadedResources = 0; function updateProgress() { loadedResources++; const progressPercent = Math.round((loadedResources / totalResources) * 100); loadingProgress.textContent = `Loading... ${progressPercent}%`; // Hide loading screen once all resources are loaded if (loadedResources === totalResources) { loadingScreen.style.display = "none"; mainContent.style.display = "block"; } } // Update progress for each image as it loads resources.forEach((img) => { if (img.complete) { updateProgress(); } else { img.addEventListener("load", updateProgress); img.addEventListener("error", updateProgress); } }); // Fallback if no resources are found (ensures progress completes) if (totalResources === 0) { loadingProgress.textContent = "Loading... 100%"; loadingScreen.style.display = "none"; mainContent.style.display = "block"; } });