Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ds = game:GetService("DataStoreService"):GetGlobalDataStore()
- game.Players.PlayerAdded:Connect(function(plr)
- wait()
- local plrkey = "id_"..plr.UserId
- local save1 = plr.leaderstats.Wins
- local save2 = plr.leaderstats.Deaths
- local save3 = plr.leaderstats.Kills
- local Saved = ds:GetAsync(plrkey)
- if Saved then
- save1.Value = Saved[1]
- save2.Value = Saved[2]
- save3.Value = Saved[3]
- else
- local NumberForSaving = {save1.Value,save2.Value,save3.Value}
- ds:GetAsync(plrkey, NumberForSaving)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(plr)
- ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Wins.Value,plr.leaderstats.Deaths.Value,plr.leaderstats.Kills.Value})
- end)
Advertisement
Add Comment
Please, Sign In to add comment