Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Module script not working?

Asked by 9 years ago

im testing a modulescript and it won't run, idk why?

I tried printing and it wont work

print("test")

2 answers

Log in to vote
2
Answered by
Tigerism 220 Moderation Voter
9 years ago

Your module needs to return some data. Otherwise, it won't work.

Module:

print("test")
return nil

Then require it in a server script.

Ad
Log in to vote
0
Answered by
KordGamer 155
9 years ago

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"])
0
You need to require() the module first. Tigerism 220 — 9y

Answer this question