Attempt to index nil with module script

I have a bug, where it says “ServerScriptService.Main.Abilities:16: attempt to index nil with ‘Head Attack’ - Server - Abilities”.
Module is a child of a server script.

Server script:

shared.Abilites = {}

task.spawn(function()
	for i,v in pairs(script:GetDescendants()) do
		if v:IsA("ModuleScript") then
			shared.Abilities[v.Name] = require(v)
		end
	end
end)

Module script:

local module = {}

module.Start = function(plr : Player, tool : Tool)
	print("Head Attack")
end

return module

Another thing: If module is just those two lines:

local module = {}

return module

Then it doesn’t work either

Sorry if there’s not enough information about the issue, its my first topic

To confirm, is this line 16, and hence the line the code is erroring on?
image

изображение
Yes, it is line 16

image

i love myself a good typo

1 Like

You have a typo on line 11.

You have it as shared.Abilites when you would want shared.Abilities

1 Like

Oh yes, im so sorry i didnt mention this, thanks for help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.