Requested module experienced an error while loading

So im working a copy of NI2, and I’m a very inexperienced scripter, when I looked for errors I could attempt to fix and noticed that whenever you unequip a tool that it displays the “Requested module experienced an error while loading”, however it does not give me any other info to go off of, so I need a pointer in the right direction
image

2 Likes

There’s more errors above that error that will show what went wrong with the module given. Show the full list of errors.

1 Like

Its just the same error over and over from me spamming the tool

1 Like

Odd, have you checked for more errors above that? Run the game again, and only unequip the tool once. Then show me the full output.

1 Like

Another script is outputting the same error, the common thing between them is the “itemModule”

Ok, so it looks like either the itemModule is indexing it’s item wrong, or it’s item just doesn’t exist. Show me the code in line 4 of the Earth Scroll ModuleScript.

That one also has me puzzled
image

This is a common mistake people can make. The module loads before the items do, so the module doesn’t see the item. Easy fix is to just replace ["Earth Scroll"] with :WaitForChild("Earth Scroll", 15).
Unfortunately this means that you have to do this in every itemModule as it looks like it’s happening to every other module.

it didn’t resolve any of the errors, i didn’t think it would either since the earth scroll script is just defining values for shop prices, which tool to give, max carry amount, etc. on top of that the tool i was testing to output the errors wasn’t the earth scroll.

image

if it helps, the section of code that I initially needed help with is checking how much of an tool/item you have and destroying it if you have over the max amount you’re supposed to have.

I must be too tired to do this, it’s hard having a break before exams come up.

Anyways, the rest of the code won’t run if the module it requires errors. I completely forgot to ask if you could add game:GetService("ServerStorage") to that line you just changed. That should fix it.

1 Like

ill test it, i appreciate you giving it a try, good luck on exams,

1 Like

Basically, an error occurred in the requested module, check the module that you required for any errors

or perhaps the module was loaded after the script loaded

There are no errors in the modules, besides the earth scroll module