Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup method for loader in case requireid fails #1511

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Loader/Loader/Loader.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading