Experiencing limit on how many modulescripts i can require from single script

Hi!

I wish to load a lot of module scripts using a single script from the serverscript service and StarterPlayerScripts.

There seems to be a limit to how many module scripts i can require from a single script. This is an issue, since the framework i made almost solely uses modulescripts as plugins.

Here are some pictures of the Framework structure:
image
image
image

Once the Core modulescript is required from the client and server, it will being requiring the rest of the modules:

I have tried calling the plugins from several different scripts, however it didn’t work properly + i’m looking for something a little more automatic than having to bind them individually.

Note: I have already ported all of my former code over to this new system, so if there is a solution i would be very happy.

Is there an error? I don’t know of any limit on requiring module scripts.

Even though it should require all modules, it doesn’t. I keep track of it using the output section. Each module prints out if they are loaded, and i can tell that not all of them are based on the missing text and functionality.

Then my guess would be that not all modulescripts have an attribute called ServerSide with its value set to true. You could add an else that prints the module to see which ones are missing.

I don’t know how Roblox internals work, but I am guessing that Roblox requires every Script, since running multiple scripts like that is not a part of lua as far as I know. So if there was a limit it would also apply to regular scripts.

Unfortunatley all the attributes correctly reflect where they are supossed to load. It loads a certain amount and then it stops going throught the rest. It doesn’t output any errors, and I have even added in lines at the end that print out a completion statement which isn’t triggered.

It’s notable to mention that not all of the client scripts load instantly, but may require a reset to trigger loading the rest and the completion statement on the client side.

Here is a view of the revised code:

It almost always load the same modules before not loading anymore.

Could you create a repro place so we can more easily see whats going on?

Something that has the same structure and requires the same scripts, but without your other code. Just enough so we can experience the issue ourselves.

Can you call each of them in a different thread / spawn() them individually? It may be that one of the modules is just yielding, preventing others from running.
i.e.

for i, v in pairs(script.Parent.Parent.MainModules:GetChildren()) do
    if v:GetAttribute("ServerSide") == true then
        task.spawn(function()
            local module = require(v)
        end)
end
for i, v in pairs(script.Parent.Parent.Addons:GetChildren()) do
    if v:GetAttribute("ServerSide") == true then
        task.spawn(function()
            local module = require(v)
        end)
end
3 Likes

It worked!

I guess I must’ve had a while loop in one of them. Thank you so much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.