From 924a81213413b944975b9e6affcf34a706129702 Mon Sep 17 00:00:00 2001 From: ccuser44 <68124053+ccuser44@users.noreply.github.com> Date: Mon, 6 May 2024 12:42:44 +0300 Subject: [PATCH] Backup method in case requireid fails --- Loader/Loader/Loader.server.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Loader/Loader/Loader.server.lua b/Loader/Loader/Loader.server.lua index 94145b50db..47ff6ed5c8 100644 --- a/Loader/Loader/Loader.server.lua +++ b/Loader/Loader/Loader.server.lua @@ -32,6 +32,7 @@ end local ServerScriptService = game:GetService("ServerScriptService") local RunService = game:GetService("RunService") +local InsertService = game:GetService("InsertService") local mutex = RunService:FindFirstChild("__Adonis_MUTEX") if mutex then @@ -157,7 +158,20 @@ else print(`Requiring Adonis MainModule; Model URL: https://www.roblox.com/library/{moduleId}`) end - local module = require(moduleId) + local success, module = xpcall(require, warn, moduleId) + if not success and type(moduleId) == "number" then -- Backup method for loading + warn(`Failed to require Adonis mainmodule {moduleId} due to {module}. If this does not work please purchase the Adonis mainmodule in your inventory. Using backup method...`) + local assets = InsertService:LoadAsset(moduleId) + + for _, v in assets do + if v:IsA("ModuleScript") then + module = require(v) + break + end + end + + assert(type(module) ~= "string", module) + end local response = module(data) if response == "SUCCESS" then