even though i used in pairs the table of settings are not changing, its still set as false even thought the “att” is set to true
-- Server
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local DSS = game:GetService("DataStoreService")
local SettingsData = DSS:GetDataStore("SettingsDataStores")
local Data
local savedatas =
{
Reflections = false;
Ambients = false;
Extras = false;
Shadows = false;
other = false;
}
Players.PlayerAdded:Connect(function(client)
local Success, Error = pcall(function()
Data = SettingsData:GetAsync(client.UserId)
end)
if Success and Data then
RS.GuiEvents.ChangeSettings:FireClient(client, Data) -- Localize the textbox with your own path
end
end)
RS.GuiEvents.SaveSettings.OnServerEvent:Connect(function(client, atts)
local success, err = pcall(function()
for attN,att in ipairs(atts) do
for savdN,savd in ipairs(savedatas) do
if attN == savdN then
savd = att
print(att, attN, "Att")
print(savd, savdN, "Saved")
end
end
end
print(savedatas)
SettingsData:SetAsync(client.UserId, savedatas)
end)
if not success then
print(err)
end
end)