Don’t do this! You can use getfenv to inject into the script environment, but that the cost of missing out on some of Luau’s optimizations. You also won’t get good IntelliSense.
My bad, currently all the table library functions only work with arrays and not dictionaries so you’ll have to use the first method I provided or you can make a custom unpack function but that seems extra and unnecessary.
I think you could do it without performance penalties like this:
(This is just @Kabutey second method, but with unnamed functions to preserve array keys so unpack works.)
Module:
local module = {
function (...) --Something
print("Something.")
end,
function (...) --Other thing.
print("Other thing.")
end,
}
return module
Script:
local Something, OtherThing = unpack(require(script:WaitForChild("ModuleScript")))
Something()
OtherThing()
The caveat is that if you ever update the module, changing the order of the functions will certainly cause things to break in a confusing way. Also, you have to name all the functions in the script whenever you require them.
Overall, I don’t think it’s a great idea, but it is possible. Maybe someone else knows a better way to do it?