Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. local Library = {}
  2.  
  3. function Library:CreateMain()
  4.  
  5.  
  6. local cc = Instance.new("ScreenGui")
  7. local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
  8. --Properties:
  9. cc.Name = "cc"
  10. cc.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  11. cc.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  12.  
  13. UIAspectRatioConstraint.Parent = cc
  14.  
  15. local main = Instance.new("Frame")
  16.  
  17. main.Name = "main"
  18. main.Parent = cc
  19. main.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
  20. main.BorderColor3 = Color3.new(1, 1, 1)
  21. main.Position = UDim2.new(0.569850028, 0, 0.415950924, 0)
  22. main.Size = UDim2.new(0, 430, 0, 136)
  23. main.InputBegan:Connect(function(input)
  24. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  25. elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  26. dragging = true
  27. draggableStart = input.Position
  28. startPos = main.AbsolutePosition
  29. elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  30. game:GetService("TweenService"):Create(main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(25, 25, 25)}):Play()
  31. end
  32. end)
  33.  
  34. main.InputEnded:Connect(function(input)
  35. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  36. dragging = false
  37. elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  38. game:GetService("TweenService"):Create(main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)}):Play()
  39. end
  40. end)
  41.  
  42. game:GetService("UserInputService").InputChanged:Connect(function(input)
  43. if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
  44. local res = cc.AbsoluteSize
  45. main.Position = UDim2.new((startPos.X / res.X) + ((input.Position.X / res.X) - (draggableStart.X / res.X)), 0, (startPos.Y / res.Y) + ((input.Position.Y / res.Y) - (draggableStart.Y / res.Y)), 0)
  46. end
  47. end)
  48.  
  49. local GamerLibrary = {Content = {}}
  50.  
  51. function GamerLibrary:NewSlider(tile, callback, max, min, startpoint)
  52.  
  53. local fames = Instance.new("Frame")
  54. local famed = Instance.new("Frame")
  55. local TextLabel = Instance.new("TextLabel")
  56.  
  57. fames.Name = "fames"
  58. fames.Parent = main
  59. fames.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
  60. fames.BorderColor3 = Color3.new(1, 1, 1)
  61. fames.Position = UDim2.new(0.0366352275, 0, 0.299019575, 0)
  62. fames.Size = UDim2.new(0, 397, 0, 54)
  63.  
  64. famed.Name = "famed"
  65. famed.Parent = fames
  66. famed.BackgroundColor3 = Color3.new(0.254902, 0.254902, 0.254902)
  67. famed.BorderSizePixel = 0
  68. famed.Size = UDim2.new((startpoint or 0) / max, 0, 1, 0)
  69.  
  70. TextLabel.Parent = fames
  71. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  72. TextLabel.BackgroundTransparency = 1
  73. TextLabel.BorderSizePixel = 0
  74. TextLabel.Position = UDim2.new(-0.000380816316, 0, 0, 0)
  75. TextLabel.Size = UDim2.new(0, 397, 0, 54)
  76. TextLabel.Font = Enum.Font.SourceSans
  77. TextLabel.Text = tile .. tostring(startpoint and math.floor((startpoint / max) * (max - min) + min) or 0)
  78. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  79. TextLabel.TextScaled = true
  80. TextLabel.TextSize = 14
  81. TextLabel.TextWrapped = true
  82.  
  83. local dragging = false
  84.  
  85. local function slide(input)
  86. local pos = UDim2.new(math.clamp((input.Position.X - fames.AbsolutePosition.X) / fames.AbsoluteSize.X, 0, 1), 0, 1, 0)
  87. famed:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
  88. local value = math.floor(((pos.X.Scale * max) / max) * (max - min) + min)
  89. TextLabel.Text = tile .. tostring(value)
  90. callback(value)
  91. end;
  92.  
  93. famed.InputBegan:Connect(function(input)
  94. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  95. dragging = true
  96. end
  97. end)
  98.  
  99. famed.InputEnded:Connect(function(input)
  100. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  101. dragging = false
  102. end
  103. end)
  104.  
  105. famed.InputBegan:Connect(function(input)
  106. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  107. slide(input)
  108. end
  109. end)
  110.  
  111. game:GetService("UserInputService").InputChanged:Connect(function(input)
  112. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  113. slide(input)
  114. end
  115. end)
  116.  
  117.  
  118. end
  119.  
  120.  
  121. return GamerLibrary
  122. end
  123.  
  124. return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement