I have tried over and over to make what's in my module script work I tested it in a normal script and it works so I removed it and just tried to print no errors nothing can anyone tell me why
MODULE SCRIPT
local module = { myFunc = function() print("function processed") end } return module
Call Module
local functionTest = require(game.ServerStorage.ModuleScript) print("done right")
I know its simple but it just won't work please help
The reason myFunc is not called is well... because you never actually call it.
The way you have your module setup, a function is defined within a table and required into a variable called functionTest.
functionTest is a table, not a function.
To call the function when the module is required, you could leave your "Call Module" script the same, and change the Module Script to look like this:
Option 1
local module = { myFunc = function() print("function processed") end } module.myFunc() -- this calls the function return module
To continue with the module script as it is, you would call the function like this:
Option 2
local functionTest = require(game.ServerStorage.ModuleScript) functionTest.myFunc() -- this calls the function "myFunc" from the module print("done right")
i fount the answer im dumb i have them in serverstorage and it didnt work so i moved it to serverscriptservice and now its working