Datastore failing to find a specific value (which IS 100% SAVED)

I store 7 values in a datastore for my game. Their names are:

  • Pyrokinesis
  • Telekinesis
  • Concilium
  • Descensum
  • Divination
  • Vitalum Vitalis
  • Transmutation

Whenever a player joins the game, I call the datastore with GetDataStore() and then put that data into a table. I then use if statements to check if each value is present, and if it is, I add a BoolValue to the player.

This works fine, aside from ONE value, Transmutation. I have it when I leave the game, and it’s saved in the datastore, but when I rejoin, it’s not even registering that the value is there so it isn’t adding it to my player.

Data Saving Script:

local WondersData = datastoreService:GetDataStore("DSJGDAOPUGODP") -- changed the actual datastore for obvious reasons

game.Players.PlayerRemoving:Connect(function(player)
	local plrWonders = {}
	if player:FindFirstChild("Bloodline") and player:FindFirstChild("Bloodline").Value ~= nil then
		BloodlineData:SetAsync(player.UserId, player.Bloodline.Value)
		print("saved bloodline")
	end
	if player:FindFirstChild("Species") and player:FindFirstChild("Species").Value ~= nil then
		SpeciesData:SetAsync(player.UserId, player.Species.Value)
		print("saved species")
	end
	if player.Species.Value == "Witch" then
		if player:FindFirstChild("Pyrokinesis") then
			table.insert(plrWonders, "Pyrokinesis")
			print("pyro")
		end
		if player:FindFirstChild("Telekinesis") then
			table.insert(plrWonders, "Telekinesis")
			print("tk")
		end
		if player:FindFirstChild("Divination") then
			table.insert(plrWonders, "Divination")
			print("div")
		end
		if player:FindFirstChild("Descensum") then
			table.insert(plrWonders, "Descensum")
			print("desc")
		end
		if player:FindFirstChild("Concilium") then
			table.insert(plrWonders, "Concilium")
			print("conc")
		end
		if player:FindFirstChild("Vitalum Vitalis") then
			table.insert(plrWonders, "Vitalum Vitalis")
			print("vit")
		end
		if player:FindFirstChild("Transmutation") then
			table.insert(plrWonders, "Transmutation")
			print("tp")
		end
		WondersData:SetAsync(player.UserId, plrWonders)
		print("saved wonders")
end

Data Checking & Value Creation Script: (relevant parts)

print("loading wonders for "..player.Name)
			local wonders = WondersData:GetAsync(player.UserId) or nil
			if table.find(wonders, "Pyrokinesis") then
				print("pyro found for "..player.Name)
				pyro = true
				local pyroV = Instance.new("BoolValue", player)
				pyroV.Name = "Pyrokinesis"
				pyroV.Value = true
				print("pyro added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Pyrokinesis"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				pyro = false
			end
			if table.find(wonders, "Telekinesis") then
				print("tk found for "..player.Name)
				tk = true
				local tkV = Instance.new("BoolValue", player)
				tkV.Name = "Telekinesis"
				tkV.Value = true
				print("tk added to "..player.Name)
				local sc = script.TKHighlight:Clone()
				sc.Parent = player.Character.PlayerConfig.Basics
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Telekinesis"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				tk = false
			end
			if table.find(wonders, "Divination") then
				print("div found for "..player.Name)
				div = true
				local divV = Instance.new("BoolValue", player)
				divV.Name = "Divination"
				divV.Value = true
				print("div added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Divination"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				div = false
			end
			if table.find(wonders, "Descensum") then
				print("desc found for "..player.Name)
				desc = true
				local descV = Instance.new("BoolValue", player)
				descV.Name = "Descensum"
				descV.Value = true
				print("desc added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Descensum"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				desc = false
			end
			if table.find(wonders, "Concilium") then
				print("conc found for "..player.Name)
				conc = true
				local concV = Instance.new("BoolValue", player)
				concV.Name = "Concilium"
				concV.Value = true
				print("conc added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Concilium"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				conc = false
			end
			if table.find(wonders, "Vitalum Vitalis") then
				print("vitalum found for "..player.Name)
				vitalum = true
				local vitalumV = Instance.new("BoolValue", player)
				vitalumV.Name = "Vitalum Vitalis"
				vitalumV.Value = true
				print("vitalum added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("VitalumVitalis"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				vitalum = false
			end
			if table.find(wonders, "Transmutation") then
				print("tp found for "..player.Name)
				tp = true
				local tpV = Instance.new("BoolValue", player)
				tpV.Name = "Transmutation"
				tpV.Value = true
				print("tp added to "..player.Name)
				w = true
				for _,v in pairs(game:GetService("ServerStorage"):FindFirstChild("ClientPowers"):FindFirstChild("Transmutation"):GetChildren()) do
					if not player.Character.PlayerConfig.Abilities:FindFirstChild(v.Name) then
						v:Clone().Parent = player.Character:WaitForChild("PlayerConfig"):WaitForChild("Abilities")
					end
				end
			else
				tp = false
			end
			print("loaded wonders for "..player.Name)
		end

Output when I leave the game, proving it saved the values:

image

Output when rejoining, every value is detected except Transmutation.

image
image

3 Likes

Save it in a table and use pcalls to save in case DataStoreService goes down

1 Like

Can you please print the table right before it gets saved, and after you load it?

1 Like

i already did. thats what the output screenshots show.

that wont fix this issue though

You should still try to save it in a table and load it out of the table

it does get saved into a table

oh….

No, your screenshot shows the result of a bunch of print statements within if statements. Try printing out the actual table.

printing the table won’t show anything different

the if statements just check if the value is in the table and if it is it prints something.

I believe you’re leaving out relevant information that you’re unaware of. Please send the entirety of your scripts. There very well could be a contradiction with the data being received, so it wouldn’t hurt to observe the information itself as your assumptions are founded on inferences by expectation and not by nature

Actually try resetting the Datastore, old data might have set a value to something that doesn’t wokr

could you please help us with getting more information on your issue by printing out the entire “wonders” table?