That script worked before i added functuion to save bool value CompletedData. Please Help! Script:
local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.UserId
local save1 = plr.leaderstats.Stages
local save2 = plr.leaderstats.Points
local save3 = plr.leaderstats.Candy
local save4 = plr.PlayerGui.QuestGui.CompletedData
local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
save3.Value = GetSaved[3]
save4.Value = GetSaved[4]
else
local NumberForSaving = {save1.Value, save2.Value, save3.Value, save4.Value}
ds:GetAsync(plrkey, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Stages.Value, plr.leaderstats.Points.Value, plr.leaderstats.Candy.Value, plr.PlayerGui.QuestGui.CompletedData.Value})
end)

3 comments
If it didn't save the boolean, make sure it was changed by a server-script. It seems like the bool value is inside the playergui and it can be because you changed the value via client-sided.
Can you explain me?
My script is a server script in server script service so