So im making a settings save system but somethings wrong, im trying to loop through the table of the config default if there is no saved setting table. My goal is to make the attribute name the setting name and the value is what it equals to
--Settings
local settingsDS = DSS:GetDataStore("Settings")
local configDefault = {
["Jumpscares"] = true,
["VoiceChat"] = false,
["SoundEffects"] = 1,
["MusicVolume"] = 1,
["PostProcessingEffects"] = false,
["ControlTips"] = true,
}
game.Players.PlayerAdded:Connect(function(player)
local configs = Instance.new("BoolValue")
configs.Parent = player
configs.Name = "settings"
for name, value in pairs(settingsDS:GetAsync(player.UserId) or configDefault) do
configs:SetAttribute(name, value)
end
end)
Picture:
