I don't know why this isn't working, i'm trying to make the loop start when game is loaded.
local module = {} local isLoaded = false module.GameLoop = function() while wait() do if game:IsLoaded() == true then isLoaded = true print('Hello World') end end end module.GameLoop() return module
ModuleScripts do not run on their own. You could notice this by seeing that ModuleScripts do not have the disabled property of a Script and LocalScript. You can make a ModuleScript work by using the require function. Here's an example:
--In ModuleScript in workspace local module = {} module.TestFunc = function() print("Hello from inside a ModuleScript!") end return module
--In Script in ServerScriptStorage local mod = require(workspace.ModuleScriptName) mod.TestFunc() --> "Hello from inside a ModuleScript!"
Here is a good resource to use when learning about ModuleScripts.
If I helped, please accept me as an answer, then we both get Reputation Points! :)
ModuleScript's do not run by themselves. You must make it run using a ServerScript or LocalScript. I'd recommend looking at this wiki article before you go on with ModuleScripts.