Please! 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)

4 comments
I may use loops, IsA, and other thing but i dont know how
Do you mind fixing the code block?
Yes, how i need to fix?
I mean what i need to do?