Advertisement
tellie789

Untitled

Feb 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. local DataStore = game:GetService("DataStoreService"):GetDataStore("JG:DataStore")
  2.  
  3. game.Players.PlayerAdded:connect(function(player)
  4.  
  5. wait(1)
  6.  
  7. local AI = Instance.new("StringValue", player.PlayerGui.EntrySystem.Frame.gui)
  8. AI.Name = "PassCode"
  9. AI.Value = ""
  10.  
  11. if script.UseDataStore.Value == true then
  12. local key = "user_" ..player.userId
  13. local savedValues = DataStore:GetAsync(key)
  14. local valuesToSave = {AI.Value}
  15.  
  16. if savedValues then
  17. -- Save format: {AI}
  18. AI.Value = savedValues[1]
  19. else
  20. DataStore:SetAsync(key, valuesToSave)
  21. end
  22. game.Players.PlayerRemoving:connect(function(player)
  23. local AI = player.PlayerGui.EntrySystem.Frame.gui.PassCode
  24. local valuesToSave = {AI.Value}
  25. local key = "user_" ..player.userId
  26. DataStore:SetAsync(key, valuesToSave)
  27. end)
  28.  
  29.  
  30.  
  31. end
  32. end)
  33.  
  34.  
  35. game.Players.PlayerAdded:connect(function(player)
  36.  
  37. wait(1)
  38.  
  39. local AI2 = Instance.new("StringValue", player.PlayerGui.EntrySystem.Frame.gui)
  40. AI2.Name = "Username"
  41. AI2.Value = ""
  42.  
  43. if script.UseDataStore.Value == true then
  44. local key = "user_" ..player.userId
  45. local savedValues = DataStore:GetAsync(key)
  46. local valuesToSave = {AI2.Value}
  47.  
  48. if savedValues then
  49. -- Save format: {AI}
  50. AI2.Value = savedValues[1]
  51. else
  52. DataStore:SetAsync(key, valuesToSave)
  53. end
  54. game.Players.PlayerRemoving:connect(function(player)
  55. local AI2 = player.PlayerGui.EntrySystem.Frame.gui.PassCode
  56. local valuesToSave = {AI2.Value}
  57. local key = "user_" ..player.userId
  58. DataStore:SetAsync(key, valuesToSave)
  59. end)
  60.  
  61.  
  62.  
  63. end
  64. end)
  65.  
  66. game.Players.PlayerAdded:connect(function(player)
  67.  
  68. wait(1)
  69.  
  70. local AI3 = Instance.new("BoolValue", player.PlayerGui.EntrySystem)
  71. AI3.Name = "HasAccount"
  72. AI3.Value = false
  73.  
  74. if script.UseDataStore.Value == true then
  75. local key = "user_" ..player.userId
  76. local savedValues = DataStore:GetAsync(key)
  77. local valuesToSave = {AI3.Value}
  78.  
  79. if savedValues then
  80. -- Save format: {AI}
  81. AI3.Value = savedValues[1]
  82. else
  83. DataStore:SetAsync(key, valuesToSave)
  84. end
  85. game.Players.PlayerRemoving:connect(function(player)
  86. local AI3 = player.PlayerGui.EntrySystem.HasAccount
  87. local valuesToSave = {AI3.Value}
  88. local key = "user_" ..player.userId
  89. DataStore:SetAsync(key, valuesToSave)
  90. end)
  91.  
  92.  
  93.  
  94. end
  95. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement