Is there a way that I could make a function from a module that can be called by a script. Example of what I am looking for:
local module = require(module)
function module:StartFunction()
--script
end
Any help is appreciated.
Is there a way that I could make a function from a module that can be called by a script. Example of what I am looking for:
local module = require(module)
function module:StartFunction()
--script
end
Any help is appreciated.
You can put a function inside the module table the modulescript returns with require call:
--ModuleScript--
local module = {}
module.StartFunction = function()
--Code here
end
return module
--Script--
local module = require(module)
module.StartFunction()
or you can just directly return a function instead of table:
--ModuleScript--
local module = function()
--Code here
end
return module
--Script--
local module = require(module)
module()
I was wanting something like this:
Script:
function module:OnFunction()
Module:
wait(2)
module:OnFunction() Triggers the function in the script.