Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. --Kai's amazing flawless point saver.
  2. --Enabled Studio APIs in Configure Game.
  3. --Publish to online place.
  4.  
  5. local save = true --You can change to true or false. this allows the players stats to save when leaving!
  6. local datastore = game:GetService("DataStoreService"):GetDataStore("Stats")
  7. local ver = "V0.1"
  8.  
  9. game.Players.PlayerAdded:connect(function(join)
  10. --Don't delete this stats and don't mess around with it unless you are good at coding!
  11. local stats = Instance.new('IntValue')
  12. stats.Name = "leaderstats"
  13. stats.Parent = join
  14. --Okay now you can create stuff right here now:
  15. cash = Instance.new('IntValue')
  16. cash.Name = "Points"
  17. cash.Parent = stats
  18.  
  19. if save == true then
  20. --okay now to load players stats
  21. cash.Value = datastore:GetAsync("Points"..join.Name) --use stat name for loading! optional
  22. end
  23. end)
  24.  
  25. game.Players.PlayerRemoving:connect(function(leave)
  26. if save == true then
  27. --we must save stats now if true
  28. datastore:SetAsync("Points"..leave.Name, cash.Value)
  29. end
  30. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement