From what I’ve learnt with Module Scripts, it should only return 1 value, most of the time a table instance. However, if you put a function in the module script, whether the module script is in or out the table, the function would run.
Furthermore, even if you delete the script and the module script, the module scripts would still run.
Video:
(Forgot to show you but, when trying to access the script via tapping the printed text, it says “Source not Found”)
Local Script
local moduleScript = require(script:WaitForChild("BugModuleTest"))
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print("E was pressed using Script")
end
end)
Module Script
local UserInputService = game:GetService("UserInputService")
local module = {}
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print("E was pressed using ModuleScript")
end
end)
module.pressQ = UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
print("Q was pressed using ModuleScript in table")
end
end)
return module