Advertisement
Guest User

Untitled

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