setting up a gun system, each gun (="tool") has a localscript which references and runs the init function of the following module:
local RS = game:GetService("ReplicatedStorage")
local module = {}
function module.init(tool: Tool)
local plr = tool:FindFirstAncestorOfClass("Player")
local typ = tool:GetAttribute("Type")
local mod = RS.Modules.Weapons:FindFirstChild(typ)
if mod == nil then return end
mod = require(mod)
print(mod)--[[
---> result:
{
["__index"] = "*** cycle table reference detected ***",
["bind"] = "function",
["fire"] = "function",
["holster"] = "function",
["init"] = "function",
["new"] = "function", <-- IT EXISTS
["reload"] = "function",
["unbind"] = "function"
}]]
local new = mod.new()
---> result:
--ReplicatedStorage.Modules.Weapons.Loader:12: attempt to call a nil value
new:init(plr, tool)
end
return module
however, the line mod.new() errors despite existing
here the "new" function that i am calling:
local m = {}
m.__index = m
function m.new()
local self = setmetatable({}, m)
return self
end
return m
anyone sees what i'm doing wrong? thanks in advance for all input

** You are now Level 1! **