UH? what's causing this

Hello, I am making some kind of “instructions” system for modules.
Basically this is my trouble;
When I do this:
image
print(yes)
It returns nil for some reason :man_shrugging:
image

But this works perfectly fine;
image
It returns this;
image

This is the trouble:
image

The module runs properly when it’s called

This is “hell” module:

local x = {
	Create = {
		
	}
}
for i,v in pairs(game.ReplicatedStorage.Models:GetChildren()) do
	table.insert(x.Create,v.Name)
	print("ok..","adding",v.Name)
end
return x

No clue why it’s returning nil.

1 Like

is the heck module parented to the thing that’s requiring it?

1 Like

Hi, yes, thanks for answer.
image

Oh. I thought it could be an issue with the parenting. I don’t really know how to help anymore. Sorry.

2 Likes

Module is “Hell”, correct?
and Hell.Module is returning nil since inside the hell module, there is no “Module”.
If you changed it to Module.Create, it would return that create table.

Hmm, no.
Module is a table, since it’s required.
INSIDE MODULE
LIke
Module.Module, then it returns “hell”
image

from what I am getting from this, sorry if I am wrong.

Module = require(script.hell)

Then when you try and do Module.Module. you are trying to index “Module” inside of script.hell, not module. But “Module” is not in the hell script… so it returns nil.

nil.Create then errors. in your console, when you print yes. it says yes is nil.

Wdym?
Module is the hell script,
Let me edit the code a bit.

This is the “Test” module

return {
	button = "TMP";
	Create = {
		"DEFAULT SET",
		"PIRATE SET",
		"MANSION SET",
		"HIGH TECH SET",
	};
	Buttons = {
		[1] = {Continue = true,ModuleImCalling = require(script.hell)};
		[2] = {Continue = true,ModuleImCalling = require(script.hell)};
		[3] = {Continue = true,ModuleImCalling = require(script.hell)};
		[4] = {Continue = true,ModuleImCalling = require(script.hell)};
	};
	Close = {
		-- close orders here.
	}
}

In the other function;

local yes = Module.ModuleImCalling
						print(yes)
						print(yes.Create)

“ModuleImCalling” code:

local x = {
	Create = {
		
	}
}
for i,v in pairs(game.ReplicatedStorage.Models:GetChildren()) do
	table.insert(x.Create,v.Name)
	print("ok..","adding",v.Name)
end
return x

Also;

It prints the name of the objects in “Models”

i mean, it calls module, this is weird lol.

Can someone help me please?
I really can’t understand what’s causing this :confused:

local yes = Module.Module
Module.Module is nil, as you printed. Inside of the table returned by Module, there is nothing called Module. I only see a Create. In your test module, I see a button, Create, Buttons, and Close, but still nothing called Module

Yes, I have fixed that, STILL returning nil.

Let me show you.

local tab = require(script.hell)
return {
	
	button = "TMP";
	Create = {
		"DEFAULT SET",
		"PIRATE SET",
		"MANSION SET",
		"HIGH TECH SET",
	};
	Buttons = {
		[1] = {Continue = true,Table = tab};
		[2] = {Continue = true,Table = tab};
		[3] = {Continue = true,Table = tab};
		[4] = {Continue = true,Table = tab};
	};
	Close = {
		-- close orders here.
	}
}

local yes = Module.Table
						print(yes)
						print(yes.Create)


Module is defined, and works perfectly, it’s just the Module.Table that keeps returning nil ;-;

Instructions is defined as Module.Buttons[i]. From there you can index the table you are looking for, e.g. local yes = Instructions.Table