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!

I am trying to load Data

  1. What is the issue? Include screenshots / videos if possible!

All bool values turns “True” after joining back even if they shouldn’t

as you can see from output
at line 316 it prints player’s saved data
some values are false some are true

but at line 320
all values turns to true

and this is the “v” which is line 317

as you can see

bool values Named “Melok”,“TestStuff” are false both in print(y.Value) and print(v)
but after line 319 which is y.Value = v
this bool values are turning “true”

if you would like to see whole code of loading

if success then
		if returnValue then -- if player Has Data
			warn(returnValue)
			-- Iterate datastore table and populate stuff in player
			for k, d in pairs(returnValue) do
				if k == "RewardsTable" then
					print("TestStuff21")
					Players_Rewards[player.UserId] = d
				else
					if type(d) == "table" then -- if table then
						for n, v in pairs(d) do
							print(d)
							warn(k,n,v)
							if player[k][n]:IsA("Folder") then  -- Is a Folder
								print(player[k])
								print(player[k][n])
								
								for t,y in pairs(player[k][n]:GetChildren()) do
									print(d,d.Value)
									print(y,y.Value)
									print(v,v.Value)
									print(t)
									y.Value = v
									print(y,y.Value)
								end
			
							else -- is a Value
								print(player[k][n])
							player[k][n].Value = v
								print(v)
								warn(k,n,v)
							end
						end
					end
				end
			end
			print(returnValue)
			print(returnValue)

and what is ReturnValue:

local dataTable = {
		["leaderstats"] = {
			Strength = strength,
			KillStreak = killStreak,
		},
		["Inventory"] = {
			EquippedTool = equippedTool,
			OwnedTools = ownedToolsTable,
			
			EquippedRank = equippedRank,
			OwnedRanks = ownedRanksTable,

			EquippedDNA = equippedDNA,
			OwnedDNAs = ownedDNAsTable,
			
			OwnedGamePasses = ownedGamePassesTable,
			AchivementsV1 = OwnedAchivementsTable
		},
		["Values"] = {
			Coins = coins,
			TotalStrength = TotalStrength,
			TotalCoins = TotalCoins,
			DailyReward = dailyReward,
			ZoneLevel = zoneLevel
		},

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

	--print(dataTable)

	local success, returnValue
	repeat
		waitForRequestBudget(Enum.DataStoreRequestType.UpdateAsync)
		success, returnValue = pcall(dataStore.UpdateAsync,dataStore,key,function()
			print(dataTable)
			return dataTable
		end)
	until success	

Yeah. I still have the problem

i dont get it why not just use profileservice and save your time and efforts?

so you would rather to turn this a discussion to actually helping with my problem?

sorry but your code is spaghetti, what i meant in my reply is you can use profileservice to easily manage player data and easily getting rid of problems like this
its not hard to implement into existing games

simply: trusting someone else’s datasaving seems like a bad idea to me
I would prefer using roblox’s own way of saving and loading it
2nd reason is
it wouldn’t improve me about solving problems it is currently a fact that there is something I am not understanding about maybe for loops or something else but it is sure there is one.
so Escaping from problem rather than solving and learning from it seems to me better way
now can we please not turn this post a dev disscussion? please?
just post if you have an idea about solving it or please don’t say anything

sorry if i offended you but, you dont have to reinvent the wheel. profileservice is created by an amazing developers and its used by thousands of developers, its also the default roblox way of saving but its a module so it handles things like session locking so data doesnt get corrupted/lost. ask any good dev and he’ll tell you he uses it. setting it up isnt hard and the documentation page already has a good working model and its not hard to change your current datastore to it
if you still want to use your way then clean the code a bit, then attach the part where you save the data

well I am not offended and it is not about reinventing the wheel. most likely it is not trusting to another’s whell no matter how well it looks or how popular it is
for 2 reason
first of all popularity does not equaly to Good or effective. it just means it is popular
2nd one is
I am not trusting to a devoloper team about my data why? simply they probably have access to data’s they are holding so they can use it to ruin my data
now you are gonna say why they should care about your data?
don’t ask me understanding humans is not a easy thing or perhaps another answer can be given would be: humans can make mistakes so. if something would happen to my game because of someone is mistakes I would like to be one who made that mistake.

it is already there

omg you’re not giving the developer your data, its just a modulescript, it saves your data like you’re doing
also can you print what V is?

wait i think i know what the problem is,
print(v,v.Value)
y.Value = v

v is a string, and it exists that means it will be true even if its false so just change it to y.Value = v.Value

not really v.Value returns nil

can you reply with what these variables are

			["Inventory"] = {
				EquippedTool = equippedTool,
				OwnedTools = ownedToolsTable,

				EquippedRank = equippedRank,
				OwnedRanks = ownedRanksTable,

				EquippedDNA = equippedDNA,
				OwnedDNAs = ownedDNAsTable,

				OwnedGamePasses = ownedGamePassesTable,
				AchivementsV1 = OwnedAchivementsTable
			},
			["Values"] = {
				Coins = coins,
				TotalStrength = TotalStrength,
				TotalCoins = TotalCoins,
				DailyReward = dailyReward,
				ZoneLevel = zoneLevel
			},


some of them are bool value some of them are string and soome of them IntValue if this is what you are asking for


all bull values are under the folder

can you show the code snippet where they get assigned

also saving on a non stop loop in case its not successful isnt so wise atleast put maximum number of tries

y.Value = v assignes the bool values