im testing a modulescript and it won't run, idk why?
I tried printing and it wont work
print("test")
im testing a modulescript and it won't run, idk why?
I tried printing and it wont work
print("test")
Your module needs to return some data. Otherwise, it won't work.
Module:
print("test")
return nil
Then require it in a server script.
Unlike Scripts or LocalScripts, ModuleScripts have to be called by a command.
For example, If I was doing a ModuleScript with a string, I would do something like this:
---This is the ModuleScript---
local module = {}
module.strings = {
["STRING1"] = "Hello! How are you doing?",
}
return module
To call it, I would enter another script and type in something like:
local String = game.Workspace.ModuleScript
local String_Data = String.strings
print(String_Data["STRING1"])
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You need to require() the module first.