Advertisement
qsenko1

Toturial Arrow first time join thing

Jul 10th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. local DataStore = game:GetService("DataStoreService")
  2. local Toturial = DataStore:GetDataStore("testJoins")
  3. game.Players.PlayerAdded:Connect(function(player)
  4. local ToturialFolder = Instance.new("Folder",player); ToturialFolder.Name = "ToturialFolder"
  5. local ArrowToPink = Instance.new("BoolValue",ToturialFolder); ArrowToPink.Name = "PinkArrow"
  6.  
  7. local PlayerUserId = "Player_"..player.UserId
  8.  
  9. --Load Data
  10. local data
  11. local success, errormessage = pcall(function()
  12. data = Toturial:GetAsync(PlayerUserId)
  13. end)
  14.  
  15. if success then
  16. if data then
  17. ArrowToPink.Value = data.ArrowToPink
  18. end
  19. end
  20. end)
  21.  
  22. game.Players.PlayerRemoving:Connect(function(player)
  23.  
  24. local PlayerUserId = "Player_"..player.UserId
  25.  
  26. local data = {
  27. ArrowToPink = player.ToturialFolder.PinkArrow.Value;
  28. }
  29.  
  30. local success, errormessage = pcall(function()
  31. Toturial:SetAsync(PlayerUserId, data)
  32. end)
  33.  
  34. if success then
  35. print("Toturial Stuff saved:)")
  36. else
  37. print("There was an error!")
  38. warn(errormessage)
  39. end
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement