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

Why my datastore script dont working? It worked before i added a Bool Value saving.

Asked by 2 years ago

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)
0
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. AProgrammR 398 — 2y
0
Can you explain me? SashaPro336 47 — 2y
0
My script is a server script in server script service so SashaPro336 47 — 2y

Answer this question