local module = {}
module.test1 = function()
return 5
end
module.test2 = function()
return 5 + module.test1()
end
return module
how would I make it only return 5 in test1 if test2 was called
since you could simply call test1 in any script
maybe im thinking too hard but im guessing something related to if statements would work
If you want functionality that’s global to all scripts when they require the module, I would recommend using global variables. You could keep a variable (something like _G.test2Called) that would keep track of if test2 was called. This global variable could be checked in test1 and handled from there.
module.test1 = function()
if _G.test2Called then
return 5
end
end
module.test2 = function()
_G.test2Called = true
-- do other stuff here
end
You could have a BoolValue that would keep track of this. Also, if you really, really don’t want to use globals, you could create some system using bindable events that would send over special keys that would verify their authenticity.