it was working a few hours ago and i've been spending those hours trying to fix this issue but i couldn't figure out why it wasn't working. i tried using require() on some other private modules like ArceusInator's GLib (which is what i based my module on) and they worked completely.
here's the code in the MainModule:
local modules = {} for _, child in pairs(script:GetChildren()) do if child:IsA('ModuleScript') then modules[child.Name] = require(child) end end setmetatable(modules, { __index = function(t, index) if index == 'Script' then local scriptClone = script:Clone() scriptClone.Name = 'Functions' return scriptClone end if type(index) == 'string' then local module = script:FindFirstChild(index) if module then modules[module.Name] = require(module) end end return rawget(modules, index) end, __call = function(t) return t.Script end }) return modules
and what i do to require() it:
local functionScript = require(--[[my private module id]]).Script functionScript.Parent = tool functionScript.Name = 'Functions' local functions = require(functionScript)