Guest User

frappe

a guest
May 17th, 2018
2,422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.23 KB | None | 0 0
  1. -- Synapse Decompiler
  2. -- Purchase Here: https://brack4712.xyz/synapse/purchase/
  3.  
  4. local Graph = script.Parent
  5. local Point = Graph:WaitForChild("Point"):Clone()
  6. local Loading = Graph:WaitForChild("Loading")
  7. local Title = Graph:WaitForChild("Title")
  8. local YLabel = Graph:WaitForChild("Y"):WaitForChild("Label")
  9. local Line = Point:Clone()
  10. Line.Name = "Line"
  11. Point.BackgroundColor3 = Color3.new(1, 1, 1)
  12. Line.BackgroundColor3 = Color3.fromRGB(160, 160, 160)
  13. Point.ZIndex = 2
  14. Graph.Point:Destroy()
  15. function DrawPoint(x, y, l)
  16.     local New = Point:Clone()
  17.     New.Position = UDim2.new(0, x, 0, 300)
  18.     New.Parent = Graph
  19.     New:TweenPosition(UDim2.new(0, x, 0, y), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.8)
  20.     New.Label.Text = l or ""
  21.     return New
  22. end
  23. function DrawLine(x0, y0, x1, y1)
  24.     if type(x0) ~= "number" then
  25.         x0, y0, x1, y1 = x0.Position.X.Offset, x0.Position.Y.Offset, y0.Position.X.Offset, y0.Position.Y.Offset
  26.     end
  27.     local New = Line:Clone()
  28.     local mag = math.sqrt((x1 - x0) ^ 2 + (y1 - y0) ^ 2)
  29.     New.Parent = Graph
  30.     New.Rotation = math.deg(math.atan2(y1 - y0, x1 - x0))
  31.     New:TweenSize(UDim2.new(0, mag, 0, 3), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5)
  32.     New.Position = UDim2.new(0, x0 + (x1 - x0) / 2, 0, y0 + (y1 - y0) / 2)
  33.     New.Size = UDim2.new(0, mag, 0, 3)
  34.     return New
  35. end
  36. function GraphPoints(points)
  37.     local highest = 0
  38.     for i, v in next, points, nil do
  39.         if highest < v[2] then
  40.             highest = v[2]
  41.         end
  42.     end
  43.     local prev
  44.     local abs = script.Parent.AbsoluteSize
  45.     local draw = {}
  46.     for i, v in next, points, nil do
  47.         draw[#draw + 1] = DrawPoint((v[1] - 1) * (abs.X / (#points - 1)), -v[2] * ((abs.Y - 100) / highest) + (abs.Y - 50), v[2])
  48.     end
  49.     wait(0.8)
  50.     for i, v in pairs(draw) do
  51.         if draw[i - 1] then
  52.             DrawLine(draw[i - 1], v)
  53.         end
  54.     end
  55.     Graph.MaxY:TweenPosition(UDim2.new(-0.078, 0, 1, -255), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5)
  56.     Graph.MaxY.Text = highest
  57. end
  58. function r()
  59.     return math.random(0, 300)
  60. end
  61. function getDataSet(size)
  62.     local data = {}
  63.     for i = 1, size do
  64.         table.insert(data, {
  65.             i * 30,
  66.             r()
  67.         })
  68.     end
  69.     return data
  70. end
  71. function Clear()
  72.     for i, v in next, Graph:GetChildren() do
  73.         if v.Name == "Point" or v.Name == "Line" then
  74.             v:Destroy()
  75.         end
  76.     end
  77. end
  78. function LoadJoins()
  79.     Clear()
  80.     YLabel.Text = "Joins"
  81.     Title.Text = "Joins per day"
  82.     Loading.Visible = true
  83.     local data = game.ReplicatedStorage.GetData:InvokeServer("joins")
  84.     Loading.Visible = false
  85.     GraphPoints(data)
  86. end
  87. function LoadUniqueJoins()
  88.     Clear()
  89.     YLabel.Text = "Unique joins"
  90.     Title.Text = "Unique joins per day"
  91.     Loading.Visible = true
  92.     local data = game.ReplicatedStorage.GetData:InvokeServer("uniquejoins")
  93.     Loading.Visible = false
  94.     GraphPoints(data)
  95. end
  96. Graph.Buttons.Data1.MouseButton1Down:Connect(LoadJoins)
  97. Graph.Buttons.Data2.MouseButton1Down:Connect(LoadUniqueJoins)
  98. local open = false
  99. local toggler = script.Parent.Parent.tog
  100. toggler.MouseButton1Down:Connect(function()
  101.     open = not open
  102.     if open then
  103.         script.Parent:TweenPosition(UDim2.new(0.5, -250, 0.5, -150), Enum.EasingDirection.In, Enum.EasingStyle.Quint, 0.6, true)
  104.     else
  105.         script.Parent:TweenPosition(UDim2.new(1.2, 0, 0.5, -150), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.6, true)
  106.     end
  107. end)
Advertisement
Add Comment
Please, Sign In to add comment