Hello!
Im currently working on a very small Game Framework for my game similar to the one by @berezaa for Vesteria and im running into an error and i don´t know how to fix it.
for i, moduleScript in pairs(directory:GetDescendants()) do
if moduleScript:IsA("ModuleScript") then
local requireModule = require(moduleScript)
modules[moduleScript.Name] = requireModule
debug:print("$Main Server: added Module " .. moduleScript.Name)
end
end
directory is a location from the table below.
I have a table with all locations of the modules i want to require.
local directories = {ReplicatedStorage.modules, ServerScriptService.contents}
When I remove the ServerScriptService.contents everything works just as expected!
BUT, when i don´t remove the ServerScriptService.contents the following error gets printed
18:24:45.136 Requested module experienced an error while loading - Server - server_test:20
18:24:45.136 Stack Begin - Studio
18:24:45.136 Script 'ServerScriptService.server_test', Line 20 - function setup - Studio - server_test:20
18:24:45.136 Script 'ServerScriptService.server_test', Line 39 - Studio - server_test:39
I think the problem is that the module is getting add when loading the game but not fully loaded while I am already requiring it.
I already tried ContentProvider:PreloadAsync() but it didn´t change anything and the error was still apearing!
I hope you have some ideas or even the Solution for this Problem.
Thanks!