Hello,
How can I call a module from :Connect() directly?
remote.OnServerEvent:Connect(function(a, b, c, d)
module_x(a, b, c, d)
end)
couldn’t find any answer online.
Hello,
How can I call a module from :Connect() directly?
remote.OnServerEvent:Connect(function(a, b, c, d)
module_x(a, b, c, d)
end)
couldn’t find any answer online.
Yes, you should be able to assuming module_x = require(module) returns a function or a metatable with a __call metamethod.
Further, if you aren’t running any code aside from the module_x call, you can do remote.OnServerEvent:Connect(module_x), although I’m not 100% sure if it would work if your module is returning a metatable with the __call thing (update: it doesn’t)
seemed to work. must’ve misspelled something earlier.