How to make a check with the ability to skip it if there is no such element?

Hello everybody!
I have a script that saves the purchase, but the BoolValue that should be saved does not appear immediately (it will appear after purchasing the location), how to make the storage script check if it is this BoolValue, and in case it does not just wait until the player should I go out and check if this is BoolValue?

local datastoreservice = game:GetService("DataStoreService")
local datastore = datastoreservice:GetDataStore("DataStoreLocationTable")



game.Players.PlayerAdded:Connect(function(player)

	local OwnedZones = Instance.new("Folder")
	OwnedZones.Parent = player
	OwnedZones.Name = "OwnedZones"
	
   
	local Sandy = player.LocalPlayer:FindFirstChild("OwnedZones"):WaitForChild("Sandy") --BoolValue
	
	local tableOfData
	local success, errormessage = pcall(function()
		tableOfData = datastore:GetAsync(player.UserId)
	end)
	if success and tableOfData then -- we know that it is a returning player whom already played this game before
		for key, value in pairs(tableOfData) do
			print(key)
			print(value)
			Sandy.Value = tableOfData["Sandy"]
		end
	end
end)
game.Players.PlayerRemoving:Connect(function(player)
	local tableOfData = {
		["Sandy"] = player.OwnedZones.Sandy.Value
	}

	local success, errormessage = pcall(function()
		datastore:SetAsync(player.UserId, tableOfData)
	end)
end)

You can do

local Sandy = OwnedZones:WaitForChild("Sandy")

Is that local script? [Char limit]

No,it’s script in ServerScript

You can’t get LocalPlayer in Server script

This will work

local datastoreservice = game:GetService("DataStoreService")
local datastore = datastoreservice:GetDataStore("DataStoreLocationTable")



game.Players.PlayerAdded:Connect(function(player)

	local OwnedZones = Instance.new("Folder")
	OwnedZones.Parent = player
	OwnedZones.Name = "OwnedZones"
	
   
	local Sandy = OwnedZones:WaitForChild("Sandy")
	
	local tableOfData
	local success, errormessage = pcall(function()
		tableOfData = datastore:GetAsync(player.UserId)
	end)
	if success and tableOfData then -- we know that it is a returning player whom already played this game before
		for key, value in pairs(tableOfData) do
			print(key)
			print(value)
			Sandy.Value = tableOfData["Sandy"]
		end
	end
end)
game.Players.PlayerRemoving:Connect(function(player)
	local tableOfData = {
		["Sandy"] = player.OwnedZones.Sandy.Value
	}

	local success, errormessage = pcall(function()
		datastore:SetAsync(player.UserId, tableOfData)
	end)
end)

It’s not working, I probably need to rework a lot in the save script to make it work

Is Sandy is valid?
[char limitt]]

That error mean can’t find Sandy.

local Dss = game:GetService("DataStoreService"):GetDataStore("DataStoreSave2")
game.Players.PlayerAdded:Connect(function(player)
	
	local OwnedZones=  Instance.new("Folder",player)
	OwnedZones.Name = "OwnedZones"

	local SpawnZones = Instance.new("BoolValue",OwnedZones)
	SpawnZones.Name = "SpawnPlace"
	SpawnZones.Value = false

	

	local GetData = Dss:GetAsync("id_" .. player.UserId)
	local OwnedZonesTable = {}
	if GetData then
		SpawnZones.Value = GetData[1]
		OwnedZonesTable  = GetData[2]

	else
		local TableData = {
			SpawnZones.Value,
			OwnedZonesTable
		}
		Dss:GetAsync("id_" .. player.UserId,TableData)

	end

	for i ,v in pairs(OwnedZonesTable) do

		local BoolVal = Instance.new("BoolValue",OwnedZones)
		BoolVal.Value = false
		BoolVal.Name =tostring(v)
	end


	for i ,v in pairs(OwnedZones:GetChildren()) do
		if  game.Workspace.Location:FindFirstChild(v.Name) then
			if v.Name == "SpawnPlace"then  
				print("SpawnPlace")
			else

				game.Workspace.Location:FindFirstChild(v.Name).BuyWall.SurfaceGui.Enabled = false
				game.Workspace.Location:FindFirstChild(v.Name).BuyWall.Transparency= 1
				game.Workspace.Location:FindFirstChild(v.Name).BuyWall.CanTouch = false
				game.Workspace.Location:FindFirstChild(v.Name).BuyWall.CanCollide = false
			end
		end
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	local OwnedZonesTable = {}
	for i ,v in pairs(plr.OwnedZones:GetChildren()) do
		if v.Name == "SpawnPlace" then 
		else
			table.insert(OwnedZonesTable,v.Name)
		end
	end
	Dss:SetAsync("id_" .. plr.UserId,{
		plr.OwnedZones.SpawnPlace.Value,
		OwnedZonesTable
	})
end)

This script has working
(tutorial : [ZONE]How to make a Simulator Game in Roblox Studio [Part 4] - YouTube )