Advertisement
Descaii

Age tracker

Mar 21st, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 KB | None | 0 0
  1. DT = game:GetService("DataStoreService"):GetDataStore("USRAGECALC")
  2. PS = DT:GetAsync("asd")
  3. PTS = {}
  4. LNS = {}
  5. if not PS then
  6.     PS = {}
  7.     DT:SetAsync("asd",PS)
  8. end
  9. function NewPL(v)
  10.     local F = false
  11.     for i,g in pairs(PS) do
  12.         if g.Name == v.Name then
  13.             F = true
  14.             g.Age = v.AccountAge
  15.         end
  16.     end
  17.     if not F then
  18.         table.insert(PS,{Name=v.Name,Age=v.AccountAge})
  19.         local C = NewP()
  20.         ypcall(function()
  21.             if PTS[#PTS-1] then
  22.                 NewLine(C.P,PTS[#PTS-1].P)
  23.             end
  24.         end)
  25.     end
  26.     DT:SetAsync("asd",PS)
  27. end
  28. function NewLine(p1,p2)
  29.     local Line = Instance.new("Part",script)
  30.     Line.Anchored = true
  31.     Line.FormFactor = "Custom"
  32.     Line.CanCollide = false
  33.     Line.Locked = true
  34.     Line.BrickColor = BrickColor.new("White")
  35.     local a = {}
  36.     a.p1 = p1
  37.     a.p2 = p2
  38.     a.Line = Line
  39.     function a:Update()
  40.         local M = (p1.Position-p2.Position).magnitude
  41.         Line.Size = Vector3.new(0,0,M)
  42.         Line.CFrame = CFrame.new(p1.Position,p2.Position)*CFrame.new(0,0,-M/2)
  43.     end
  44.     table.insert(LNS,a)
  45.     return a
  46. end
  47. function NewP()
  48.     local R = Instance.new("Model",script)
  49.     local P = Instance.new("Part",R)
  50.     P.Anchored = true
  51.     P.FormFactor = "Custom"
  52.     P.Name = "Head"
  53.     P.CanCollide = false
  54.     P.TopSurface = "Smooth"
  55.     P.BottomSurface = "Smooth"
  56.     P.Locked = true
  57.     P.BrickColor = BrickColor.new("Black")
  58.     P.Size = Vector3.new(0.5,0.5,0.5)
  59.     Instance.new("SpecialMesh",P).MeshType = "Sphere"
  60.     Instance.new("Humanoid",R).MaxHealth = 0
  61.     local c = {}
  62.     c.P = P
  63.     c.R = R
  64.     table.insert(PTS,c)
  65.     return c
  66. end
  67. for i,v in pairs(PS) do
  68.     local C = NewP()
  69.     ypcall(function()
  70.         if PTS[#PTS-1] then
  71.             NewLine(C.P,PTS[#PTS-1].P)
  72.         end
  73.     end)
  74. end
  75. game.Players.PlayerAdded:connect(function(v)
  76.     NewPL(v)
  77. end)
  78. function clerp(a,b,c)
  79.     return CFrame.new(
  80.         a.X+(b.X-a.X)*c,
  81.         a.Y+(b.Y-a.Y)*c,
  82.         a.Z+(b.Z-a.Z)*c
  83.     )
  84. end
  85. coroutine.resume(coroutine.create(function()
  86.     for i,v in pairs(game.Players:GetPlayers()) do
  87.         wait(0.5)
  88.         NewPL(v)
  89.     end
  90. end))
  91. A = 0
  92. while wait() do
  93.     A = A +(2/#PS)
  94.     table.sort(PS,function(c,d) if c.Age ~= d.Age then return c.Age > d.Age else return #c.Name>#d.Name end end)
  95.     for i,v in pairs(PS) do
  96.         --print(i,.Name,v.Age)
  97.         for _,g in pairs(PTS) do
  98.             if _ == i then
  99.                 g.R.Name = v.Name.."\nAge:"..v.Age.."("..tostring(math.ceil((v.Age/365)*100)/100)..")"
  100.                 g.P.CFrame = clerp(g.P.CFrame,
  101.                     CFrame.new(0,1+v.Age/50,0)
  102.                     *CFrame.Angles(0,math.rad(A),0)
  103.                     *CFrame.new(0,0,(i*4)-(#PS*4)/2),
  104.                 0.1)
  105.                 --print(g.P.CFrame)
  106.             end
  107.         end
  108.     end
  109.     for i,v in pairs(LNS) do
  110.         ypcall(function()
  111.             v:Update()
  112.         end)
  113.     end
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement