Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. while true do
  2. for i,plr in pairs(game.Players:GetChildren()) do
  3. if plr.UserId > 0 then
  4. local w = sessionData[plr.UserId].Steps
  5.  
  6. if w then
  7. pcall(function()
  8. dataStoreSteps:UpdateAsync(plr.UserId,function(oldVal)
  9. return tonumber(w)
  10. end)
  11. end)
  12. end
  13. end
  14. end
  15.  
  16. local smallestFirst = false
  17. local numberToShow = 100
  18. local minValue = 1
  19. local maxValue = 10e30
  20. local pages = dataStoreSteps:GetSortedAsync(smallestFirst, numberToShow, minValue, maxValue)
  21.  
  22. local top = pages:GetCurrentPage()
  23. local data = {}
  24.  
  25. for a,b in ipairs(top) do
  26. local userid = b.key
  27. local points = b.value
  28. local username = "[Failed To Load]"
  29.  
  30. local s,e = pcall(function()
  31. username = game.Players:GetNameFromUserIdAsync(userid)
  32. end)
  33.  
  34. if not s then
  35. warn("Error getting name for "..userid..". Error: "..e)
  36. end
  37.  
  38. local image = game.Players:GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
  39. table.insert(data,{username,points,image})
  40. end
  41.  
  42. ui.Parent = script
  43.  
  44. for i,v in pairs(sf:GetChildren()) do
  45. if v:IsA("Frame") then
  46. v:Destroy();
  47. end
  48. end
  49.  
  50. ui.Parent = sf
  51.  
  52. for number,d in pairs(data) do
  53. local name = d[1]
  54. local val = d[2]
  55. local image = d[3]
  56. local color = Color3.new(1,1,1)
  57. if number == 1 then
  58. color = Color3.new(1,1,0)
  59. elseif number == 2 then
  60. color = Color3.new(0.9,0.9,0.9)
  61. elseif number == 3 then
  62. color = Color3.fromRGB(166, 112, 0)
  63. end
  64. local new = sample:Clone()
  65. new.Name = name
  66. new.LayoutOrder = number
  67. new.Image.Image = image
  68. new.Image.Place.Text = number
  69. new.Image.Place.TextColor3 = color
  70. new.PName.Text = name
  71. new.Value.Text = val
  72. new.Value.TextColor3 = color
  73. new.PName.TextColor3 = color
  74. new.Parent = sf
  75. end
  76. wait()
  77.  
  78. sf.CanvasSize = UDim2.new(0,0,0,ui.AbsoluteContentSize.Y)
  79.  
  80. wait(10)
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement