Advertisement
Guest User

Untitled

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