local module = {} function module.Molly() local Ammo = 555 end return module
local s = require(game.ReplicatedStorage.Test) print(s.Ammo) <--- Idk how to print that table
Module scripts do not turn over variables to the script requiring it. Meaning, you would have to refer to the module script each time you want to gather the variable.
There are a couple ways to go about gathering information. Either through getters or through the table you're returning.
A "getter" is known in programming terms to be a value that gets returned to another class or code to be set as a variable.
Module Script:
local module = {} local Ammo = 555 function module.Molly() return Ammo end return module
Requiring Script:
local mod = require(moduleName) local Ammo = mod.Molly()
Since the value gets returned when calling the function, all we simply have to do is set Ammo in the Requiring Script to a variable. Otherwise, you'd be calling mod.Molly()
every time you need Ammo.
For this script, you don't even need a function to return a value.
Module Script:
local module = { Ammo = 555 } --Alternative method for outside the table would be to set module.Ammo = 555. return module
Requiring Script:
local mod = require(moduleName) local Ammo = mod.Ammo