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

Difference between Module Scripts than the others?

Asked by 10 years ago

I wanna know what's different about module scripts than the others

1 answer

Log in to vote
1
Answered by
Jonibus 30
10 years ago

A Module script is almost like an engine, acting like global functions: It's a convenient way to store tables and functions globally throughout the game, and then be able to require() them in other scripts to access the data and functions. For example...

-- ModuleScript
functions = {}

functions.printHi = function()
print("Hi")
end

return functions

Then, in a regular script, you can do this

functions = require(workspace.ModuleScript)

functions.printHi()

The result would be printing "Hi". You can also store data in tables, such as an admins list, so that you don't need an admin table in several scripts.

Does that clarify it a bit for you? Probably was a bit vague and someone else could explain it better.

0
No, you explained it great, thx. Operation_Meme 890 — 10y
Ad

Answer this question