Here is a factorial function module that I made a while ago but I haven't posted it on devforum yet

here is the factorial module

the module is parented to a server script and the server script already has what you need to know
the script below is what is inside the server script

local FactorialModule = require(script.Parent)
local Fac = FactorialModule["!"]

print(Fac(5))

local Fac can be named anything it doesn’t have to be Fac() it could be also be math.fact() if you add a bit more stuff to it

I think I covered how to use it now have fun and please tell me if there are any bugs with this

1 Like
local math = {}
math.__index = math
math = setmetatable(math, _G.math) -- combining with the built-in math

math.fact = function(n)
  return n
end

print(math.fact(10))

thanks for the reply
im actually working on a new module rn so this is helpful