ModuleScript Error

Im attempting to call a module script from a few other script but I keep getting the error in the image below

image

I’ve checked both the script calling the module and the module script itself but there doesn’t seem to be any errors nor is there anything in output outlining any errors there would be, API service and HTTP requests are enabled.

local TM = require(StarterPack:WaitForChild("ToolManagment"))

I cannot send the modulescript itself as it is far too long, just know there is no errors inside of it.

what type of script are you trying to call the module?

If you are sure there are no errors in the module itself, most likely the path is wrong or nil. (“ToolManagment” or “ToolManagement”?)

waitForChild behaves like an event so won’t fire if the module has already loaded, I would try optionally defining it such as:

local TM = require( StarterPack:FindFirstChild("ToolManagment") or StarterPack:WaitForChild("ToolManagment"))

Just also thought, anything in the StarterPack is copied into the player’s backpack when the character loads, so the path will change when the script actually runs.

1 Like

Are there anymore errors logged in the console before the ModuleScript.

There seems to be a different error above:
image

You can’t load it if the ModuleScript itself has a error inside of it.

1 Like

Use pcall for that part of the module or a specific function in order to detect what is causing it. I will only give example usage since you can’t post script fully here.

Example:

local s,e = pcall(function()
 -- Insert code here
end)
if not s or e then
 warn("error in module: "..tostring(e).." | "..debug.traceback()) -- will print out any errors inside pcall
end

There are errors but they aren’t associated with this at all, just some random stuff

did you returned the module table at the end of the script?

like this:

local module = {}

return module <—

i got a error like this and the issue was this

yeah i have return at the end of the module

the error means that there is an error in the module script