So I have this problem that I dont really understand, this is my first time using module scripts so im not sure exactly how they work, but I have checked the module script page on the dev forums. Basically what I understood is that a module script can be required in another separate script, and as a result the script can call functions in the module script
Here is where my understanding of module scripts doesnt make sense:
What I expected was that the player connect script would call the invHandler:NewInventory function, but when I look at the output the function is being called before the player added function.
If anyone could send me something to help me understand or explain whats going on I would appreciate it
Quick update: I know remote functions are what you would usually used to call functions between scripts but I still want to understand module scripts and how they work since they seem more convenient
The reason i believe the print(inventories["AbuBaltz"]) is being called before the player added is because essentially the second a module script is required it is “ran” or in better terms returned and you are connecting your player added function after this( if that makes sense)
There are lots you can do with module scripts, including with uses of OOP( Object-Oriented programming)
This might help you better understand (if i didn’t explain well)