Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Difference between Module Scripts than the others?

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

1 answer

✓ Accepted answer

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.

1 comment

0

No, you explained it great, thx.

This discussion is preserved as it was. New answers, comments, and votes are closed.