Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1.  
  2. local datastore = game:GetService("DataStoreService")
  3. local ds1 = datastore:GetDataStore("RankSaveSystem")
  4.  
  5. game.Players.PlayerAdded:connect(function(plr)
  6.  local folder = Instance.new("Folder", plr)
  7.  folder.Name = "leaderstats"
  8.  local rank = Instance.new("StringValue", folder)
  9.  rank.Name = "Rank"
  10.  
  11.  rank.Value = ds1:GetAsync(plr.UserId) or 0
  12.  ds1:SetAsync(plr.UserId, rank.Value)
  13.  
  14.  
  15.  rank.Changed:connect(function()
  16.   ds1:SetAsync(plr.UserId, rank.Value)
  17.  
  18.  
  19.  end)
  20.  
  21.  
  22.  end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement