I have a problem with this module

What am I doing? I am creating an efficient datastoring module, very user friendly and easy to use.

What do I need help with?
The GetData part, I want to utilize tables for organization purposes. The real question is, how would I find the stuff inside the table? and find what it is?
Here is my code:

function DSSfunc.GetData(PlayerInstance, TableToGet, DictionaryName)
	local data
	local success, errormsg = pcall(function()
		local Store = DSS:GetDataStore(DictionaryName)
		data = Store:GetAsync(PlayerInstance)
	if success and data then
		--Heres the problem

The call script:

local CanaryData = require(script.CanaryData)
local DataFolderName = ""
local DictionaryName = ""

	local TableToGet = {
		-- Add paths to the instances inside the folder you want to save
		-- For example: Player:WaitForChild(DataFolderName):WaitForChild("Instance")
		-- << Add code here (remove)

So really, how would I link the table in the callscript up with the module?
Heres the value adder (this probably has something to do with this)

function DSSfunc.AddValue(InstanceType, PlayerInstance, InstanceName, DefaultNumber, DefaultBool)
	if InstanceType == "BoolValue" then
		local BoolValue = Instance.new("BoolValue")
		BoolValue.Parent = PlayerInstance
		BoolValue.Name = InstanceName
		BoolValue.Value = DefaultBool
	elseif InstanceType == "StringValue" then
		local StringValue = Instance.new("StringValue")
		StringValue.Parent = PlayerInstance
		StringValue.Name = InstanceName
		StringValue.Value = DefaultNumber
	elseif InstanceType == "NumberValue" then
		local NumberValue = Instance.new("NumberValue")
		NumberValue.Parent = PlayerInstance
		NumberValue.Name = InstanceName
		NumberValue.Value = DefaultNumber

I’m a little confused as to what you’re asking. Are you trying to serialize value instances? Or are you trying to convert data to instances? Or are you trying to do something else?

Sorry the post is messy, im in a rush.

But, I want to link the table in the call script up with the module and then vice versa.
So when a script calls the AddValue function it adds the value to the table in the callscript, and then when the GetData function is called, I want to grab those objects from the table to save them.

Sorry, I’m still a bit confused. Are you trying to convert value instances in a folder to a table to be saved to a datastore? For example:

t = {                    --> 
    test = true;              BoolValue name = test, value = true
    test2 = false;            BoolValue name = test2, value = false

and vice versa?

Nope, I want to have a global table that works across 2 scripts.


Can’t you just do it as normal then? Tables can be mutated and will “sync” to all references if you make changes to them, just like instances.

local module = {}
module.t = {}
return module

Script 1:

module.t.test = true

Script 2:

print(module.t.test) --> true