Module Script variable's not updating it's value's

Hello everyone, as with the title, i’m having issues changing the values in a module script’s table. like so:

--Module Script
local PlayerData = {{Gold = 0},{MusicMedal = false},...} -- there are 12 values total
return PlayerData
--Local Script
local Data = requiere(Location.PlayerData) --Module script
--Here is the issue, i've attempted:

for i,v in pairs(Data[2]) do
   v = true
end

--------------------------------

Data[2] = {MusicMedal = true}

-------------------------------------

table.remove(Data,2)
table.insert(Data,2,{MusicMedal = true})

But unfortunately, none of these update the Module scripts variables. When I print out what information the module’s table is holding, it keeps printing the original information contained within, which all values are false, and the first one is 0.

Also i’m new at using module scripts, so are they just like permanent information holders, where their table’s cant be updated to something else?

? Why is it data [2]? Dosent that bring one of the variable in a table.

Yes, I need to update one variable specifically, since each variable deals with a different aspect in the game. However is there a better way to reference a specific variable?

2 Likes