How do I use :Method if the function is in another module?

Let say I have a module filled with functions and a script to call it
what I want to do is that

Module:

local Module = {}
Module.Test = function()
print(self)
end

Script:

local Module = require(Module)
Instance:Test()
-- I want this to print Instance as stated in the Test function

now I know this doesnt work but just so you know what I am trying to do

well you can’t call Instance:Test() because Module is the name of that variable.
Call Module:Test() and see what’s printed.

Self is a keyword that is usually only used with OOP and metatables.

But how or why? If you really want to do that, you can do this:

local Module = require(Module)
Module.Test(Instance) --> prints Instance

The functionality you’re asking for doesn’t exist in Luau

2 Likes