How do i fix "attempt to call nil value"?

im trying to make a dungeon game and im not sure what to do, im pretty sure i have to fill in the () but im not sure with what. Can someone help me?
This is where the error is

local armor = armorModule.chooseRandomArmor()  -- Error here
local cooldown = false
local attackAnimation = Instance.new("Animation")
local animationID = "rbxassetid://6505914323"
attackAnimation.Parent = game:GetService("ReplicatedStorage") -- for easy access later
attackAnimation.AnimationId = animationID
local myNPC = workspace.Mobs.NPC
local npcHumanoid = myNPC:FindFirstChildOfClass("Humanoid")
local armorModule = require(game.ServerScriptService:WaitForChild("ArmorHandler"))

script.Parent.npchum.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
		local animator = npcHumanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator")
		animator.Parent = npcHumanoid
		if not cooldown then
			cooldown = true
			local animation = animator:LoadAnimation(attackAnimation)
			animation:Play()
			hum:TakeDamage(25)
			wait(1)
			cooldown = false
				
			end
		end
end)
myNPC.npchum.Died:Connect(function()
	myNPC:Destroy()
	
	local armor = armorModule.chooseRandomArmor()  -- Error here
	
	print(armor.Name.." selected")
end)

What is the armor module? aaaa

1 Like

here

local armormodule = {}

armormodule.armors = {
	["Legendary"] = {
		game.ReplicatedStorage.Armors.LegendaryArmor
	};

	["Epic"] = {
		game.ReplicatedStorage.Armors.EpicArmor
	}

}

armormodule.rarities = {
	["Legendary"] = 0.0001; -- 0.001% chance

	["Epic"] = 10; --10% chance 

}



armormodule.chooseRandom = function()

	local randomNumber = math.random(1,100.1)

	local counter = 0

	for rarity, weight in pairs(armormodule.rarities) do
		counter = counter + weight
		if randomNumber <= counter then

			local rarityTable = armormodule.armors[rarity]
			local chosenArmor = rarityTable[math.random(1,#rarityTable)]

			return chosenArmor

		end
	end

end

return armormodule

There is no function called chooseRandomArmor, only chooseRandom

:man_facepalming:sorry for wasting your time