Advertisement
Guest User

script uno

a guest
Feb 24th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. local DataStore = game:GetService("DataStoreService"):GetDataStore("STAT")
  2.  
  3. local function onPlayerAdded(player)
  4. local plr = game.Workspace:WaitForChild(player.Name)
  5. local starterGui = game:GetService('StarterGui')
  6. local stats = Instance.new("Folder", player)
  7. local clife = Instance.new("StringValue", stats)
  8. local cash = Instance.new("IntValue", stats)
  9. local net = Instance.new("IntValue", stats)
  10. local dead = Instance.new("BoolValue", stats)
  11. local educated = Instance.new("IntValue", stats)
  12. local sex = Instance.new("IntValue", stats)
  13. local data
  14. local data1
  15. local data2
  16. local data3
  17. local data4
  18. local data5
  19. local data6
  20. pcall(function()
  21. data = DataStore:GetAsync(plr.UserId)
  22. data1 = data[1]
  23. data2 = data[2]
  24. data3 = data[3]
  25. data4 = data[4]
  26. data5 = data[5]
  27. data6 = data[6]
  28. end)
  29. if data4 ~= nil then
  30. if data1 ~= nil then
  31. cash.Value = data1
  32. else
  33. cash.Value = 0
  34. end
  35. if data2 ~= nil then
  36. clife.Value = data2
  37. else
  38. clife.Value = "Life"
  39. end
  40. if data3 ~= nil then
  41. net.Value = data3
  42. else
  43. net.Value = 0
  44. end
  45. if data4 == false then
  46. dead.Value = false
  47. else
  48. dead.Value = true
  49. end
  50. if data5 ~= nil then
  51. educated.Value = data5
  52. else
  53. educated.Value = 0
  54. end
  55. if data6 ~= nil then
  56. sex.Value = data6
  57. else
  58. sex.Value = 0
  59. end
  60. else
  61. dead.Value = true
  62. end
  63. stats.Name = "leaderstats"
  64. sex.Name = "sex"
  65. clife.Name = "clife"
  66. cash.Name = "cash"
  67. net.Name = "net"
  68. dead.Name = "dead"
  69. educated.Name = "educated"
  70.  
  71. plr.Torso.Anchored = true
  72. end
  73. local function onPlayerLeave(player)
  74. local plr = game.Workspace:WaitForChild(player.Name)
  75. local starterGui = game:GetService('StarterGui')
  76. local stats = player.leaderstats
  77. local clife = stats.clife
  78. local cash = stats.cash
  79. local net = stats.net
  80. local dead = stats.dead
  81. local sex = stats.sex
  82. local educated = stats.educated
  83. local data
  84. pcall(function()
  85. data = DataStore:SetAsync(plr.UserId, {
  86. cash.Value,
  87. clife.Value,
  88. net.Value,
  89. dead.Value,
  90. educated.Value,
  91. sex.Value
  92. })
  93. end)
  94. end
  95.  
  96. game.Players.PlayerAdded:Connect(onPlayerAdded)
  97. game.Players.PlayerRemoving:Connect(onPlayerLeave)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement