Help with loading data

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Okay so I am trying to load data which is a descendant of folder
    player>Folder>AnotherFolder>The Value I want to load back

  2. What is the issue? Include screenshots / videos if possible!
    I somehow can’t reach them
    This is the Error I am getting
    attempt to call missing method ‘GetChildren’ of string
    but it must be a folder not a string? right?

if success then
		if returnValue then --If player has any saved value
			warn(returnValue)
			-- Iterate datastore table and populate stuff in player
				for k, d in pairs(returnValue) do
					if k == "RewardsTable" then
						Players_Rewards[player.UserId] = d
					else
						if type(d) == "table" then
							for n, v in pairs(d) do
							warn(k,n,v)
							
							if player[k][n]:IsA("Folder") then -- Is a Folder
								print(k) -- Returns String -- Name Of the Folder
								print(n) -- Returns String
								print(k:GetChildren()) --attempt to call missing method 'GetChildren' of string error
								print(n:GetChildren())
							
							else -- is a Value
							player[k][n].Value = v	
							
							print(v)
								end
							end
						end
					end
			end

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Those are the values I am trying to reach they all are bool values
Screenshot_180

This is the Saving part it works it saves all of values but I can’t load it back

local function save(player)
	local userID = player.UserId
	local key = "Player_"..userID
	--Yeni Currency A1

	local equippedTool = player.Inventory.EquippedTool.Value 
	print(equippedTool)
	local ownedFirstTable = {}
	for _, tool in ipairs(player.Inventory.First:GetChildren()) do
		ownedSecondTable[tool.Name] = tool.Value
	end
	local ownedGamePassesTable = {}
	for i,v in ipairs(player.Inventory.Third:GetChildren()) do
		ownedThirdTable[v.Name] = v.Value
	end
	local NameOfTotals= player.Inventory.NameOfTotals.Value 
	local ownedThirdsTable = {}
	for _, rank in ipairs(player.Inventory.OwnedThird:GetChildren()) do
		ownedSecondsTable[rank.Name] = Third.Value
	end 

	local equippedStuff = player.Inventory.EquippedStuff.Value 
	local ownedFirstsTable = {}
	for _, First in ipairs(player.Inventory.Firs:GetChildren()) do
		ownedFirstTable[First.Name] = First.Value
	end 

	

	local CurrentTimestamp = os.time()

	local dataTable = {
		["third"] = {
			Veloka= veloka,
			Time= time,
		},
		["Inventory"] = {
			EquippedTool = equippedTool,
			OwnedTools= ownedSecondTable,
			NameOfTotals= NameOfTotals,
			Third= ownedThirdTable,

			EquippedStuff = equippedStuff,
			First= ownedFirstThingsTable,
			Second= ownedSecondThingsTable,
		},
		["Values"] = {
			Tankil= tankil,
			Wenkol= Wenkol,
		},

		["RewardsTable"] = Players_Rewards[player.UserId]
	}

k is clearly a string. GetChildren is for instances only.

Well no and yes this depends on which k you mean. the one k:GetChildren “K” is the main Folder named Inventory but it doesn’t return children of it. just name of the folder

There is only one k and it is never changed. It’s a string. Did you mean to do player[k]:GetChildren()?

1 Like

oh, welp yeah now it returns the children of the second degree folders
so, how can I load the values of it?

just a suggestion but you should really consider using ProfileService for player data

1 Like