Advertisement
vendaskOfficial

Data Store Script

Aug 25th, 2018
29,252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
  2. RebirthData = game:GetService("DataStoreService"):GetDataStore("RebirthData")
  3.  
  4. game.Players.PlayerAdded:Connect(function(plr)
  5.     local LB = Instance.new("IntValue")
  6.     LB.Name = "leaderstats"
  7.    
  8.     local p = Instance.new("IntValue")
  9.     p.Name = "Points"
  10.     p.Value = PointData:GetAsync(plr.userId) or 0
  11.    
  12.     local r = Instance.new("IntValue")
  13.     r.Name = "Rebirths"
  14.     r.Value = RebirthData:GetAsync(plr.userId) or 0
  15.  
  16.     LB.Parent = plr
  17.     p.Parent = LB
  18.     r.Parent = LB
  19. end)
  20.  
  21. game.Players.PlayerRemoving:Connect(function(plr)
  22.     PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
  23.     RebirthData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value)
  24. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement