In my script I have a for i, v loop that puts all of the modules that are descendants to the local script in a dictionary. This loop for some reason just yields the script and I get no errors or nothing. I have used this same method many other times and it always works.
I have tried printing text after the loop and the text doesn’t print.
Here is my code:
local Modules = {}
for _, Module in ipairs(script:GetDescendants()) do
if Module:IsA("ModuleScript") then
Modules[Module.Name] = require(Module)
end
end
you can insert all the modules to the Modules Table like above,
and then you can loop again in the Modules Table and require the modules
for ex
local Modules = {}
for _, Module in (script:GetDescendants()) do
if Module:IsA("ModuleScript") then
table.insert(Modules,Module)
end
end
for i,Module in pairs(Modules()) do
require(Module)
end
Add a print statement right before the requiring of your module, and print the module name. That will allow you to see which module is causing this yield. I’m 99% sure your code is yielding due to one of your modules.
local Modules = {}
for _, Module in ipairs(script:GetDescendants()) do
if Module:IsA("ModuleScript") then
print(Module.Name) -- this will allow us to see which modules pass or cause the yield
Modules[Module.Name] = require(Module)
print(Module.Name .. " is done being required")
end
end
Once you find that out the next step will be to debug that module and see what’s causing the error or yielding. You could be using a coroutine or something with buggy code which won’t throw an error into the output.
I tryed that and found the script that was causing the problem. I then commented everything in the script then uncommented everythind one by one, and that somehow fixed the problem.