Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why datastore script dont saves that bool value?

Asked by 2 years ago
Edited 2 years ago

I took that script from my leaderstats datastore script & changed value to save. Also this is server script. Please Help, i need that for my christmas update, one last thing to do! Script:

local ds = game:GetService("DataStoreService"):GetDataStore("QuestData")
    game.Players.PlayerAdded:Connect(function(plr)
            wait(1)
        local plrkey = "id_"..plr.UserId
            local save1 = plr.PlayerGui.QuestGui.CompletedData

            local GetSaved = ds:GetAsync(plrkey)
            if GetSaved then
                    save1.Value = GetSaved[1]
                else
                local NumberForSaving = {save1.Value}
                    ds:GetAsync(plrkey, NumberForSaving)
                end
        end)

    game.Players.PlayerRemoving:Connect(function(plr)
            ds:SetAsync("id_"..plr.UserId, {plr.PlayerGui.QuestGui.CompletedData.Value})
        end)

Answer this question