I tried looking around the forum but I can’t find what I’m looking for. Basically, I get the error that “Module code did not return exactly one value” and nothing else. I can’t find the source of it and I have no idea how to proceed.
It’s literally just that, nothing else. Any ideas?
This means that your ModuleScript returned 2 or more values, in other words your ModuleScript attempted to return a tuple, ModuleScripts can only return a single value, typically a table value containing all of the features of the ModuleScript itself.
Only solution I can think of is pressing Ctrl + Shift + F, type “return” and manually look through module scripts to see which one(s) return multiple values/no values.
Figured the issue out, basically I iterated through all descendants where module scripts are located, attempted to require them with a pcall, and if it wasn’t successful it outputted a print, 2 separate loops because of an error that the array was too long to unpack, this should work though.
Lazily written, ignore horrible variable names:
for i,v in pairs({unpack(game.ReplicatedStorage:GetDescendants()); unpack(game.StarterGui:GetDescendants())}) do
if v:IsA('ModuleScript') then
coroutine.wrap(function()
local s,e = pcall(require, v)
if not s then
print(e,v)
end
end)()
end
end
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA('ModuleScript') then
coroutine.wrap(function()
local s,e = pcall(require, v)
if not s then
print(e,v)
end
end)()
end
end