I want different scripts to call upon different function from my module script.
In module script
1 | function hi() |
2 | print ( "hi" ) |
3 | end |
4 |
5 | function bye() |
6 | print ( "bye" ) |
7 | end |
8 |
9 | return bye , hi |
In Normal script (this is where I'm confused on)
1 | hi = require(blah.blah.ModuleScript) |
2 |
3 | hi() |
Modules
Modulescripts may only return a single function, so you might want to instead package the stuff into a table.
1 | function hi() |
2 | print ( "hi" ) |
3 | end |
4 |
5 | function bye() |
6 | print ( "bye" ) |
7 | end |
8 |
9 | return { bye = bye , hi = hi } |
Then in a script, you just access it like any other table.
1 | hi = require(blah.blah.ModuleScript).hi -- Note, .hi without () |
2 |
3 | hi() |