So i was working on a system for storing inventory data and i ran into this problem:
-- Module script
local module = {
Data = {}
}
return module
There is an empty table named “Data” in this module script.
-- First script
local Data_Module = require(script.Parent.Data_Module)
Data_Module.Data["Money"] = 101
print(Data_Module.Data.Money) --prints 101
This works fine so far.
-- Second script
local Data_Module = require(script.Parent.Data_Module)
print(Data_Module.Data.Money) --prints nil
The data only changes for the script that changed it.
I really don’t know how to solve this problem. If anybody here could tell me how to make the module change across scripts, it would be very helpful.