How would I add a setting to my settings system (which is datastored) without resetting the entire datastore?

My settings system is saved across datastore so the players only have to set it once for it to save, but I keep having to reset everyone’s datastore because I want to add a new configuration. At the moment I’m trying to work out a way to compare the two tables, the Player’s settings and the Settings Module (with the new setting), but it is very tricky and I am wondering if anyone has an idea or a way of doing this that is efficient.

Thanks

Current PlayerJoined code
function PlayerJoined(Player)
	if Player.ClassName == "Player" then
	local Data = GetDataStore(Player)
		if not Data then
			print("new data")
			Data = require(game:GetService("ReplicatedStorage").Settings).Settings
	end
	buffer[Player.UserId] = Data
	local datafolder = Instance.new("Folder")
	datafolder.Parent = Player
		datafolder.Name = "Settings"
		for _, SettingSet in pairs(require(game:GetService("ReplicatedStorage").Settings).Settings) do
			for _, Setting1 in pairs(Data) do
				-- Attempt to compare the tables
			end
		end
	for _, Setting in pairs(Data) do
		local val = Instance.new("BoolValue")
		val.Parent = datafolder
		val.Name = Setting.ID
		val.Value = Setting.Enabled
		end
	end
end

Just figured this out, going to test it:

for _, SettingSet in pairs(require(game:GetService("ReplicatedStorage").Settings).Settings) do
			for _, Setting1 in pairs(Data) do
				if not table.find(Data,SettingSet) then
					table.insert(Data,SettingSet)
				end
			end
		end

Edit: This seemed to work, :smile: