Attempt to index nil with TABLE

I’ve created some settings for a gun but whenever I try to get a table from a ModuleScript it gives me the error:

  • attempt to index nil with 'Glock17Settings

Here is the ModuleScript

local Settings = {

 Glock17Settings = {
	
	Damage = 12;
	MagSize = 8;
	FireRate = 0.15;
	
};

 Glock18Settings = {
	
	Damage = 5;
	MagSize = 12;
	FireRate = 0.07;
	
};

 ColtM1911Settings = {
	
	Damage = 14;
	MagSize = 8;
	FireRate = 0.2;
	
};

 DesertEagleSettings = {
	
	Damage = 33;
	MagSize = 4;
	FireRate = 1.5;
	
};

 M16Settings = {
	
	Damage = 11;
	MagSize = 20;
	FireRate = 0.15;
	
};

 AK47Settings = {
	Damage = 6;
	MagSize = 30;
	FireRate = 0.08;
	
};
	
	};

return Settings

Now here is the part it errors in, a different script

local GSM = require(game:GetService("ServerStorage"):WaitForChild("GunSettingsModule"))
local Settings = GSM.Settings
local G17S = Settings.Glock17Settings

you returned a table, knowing this, local settings = require(module)

2 Likes