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 5.14 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. main.InputBegan:Connect(function(input)
  28. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  29. if not main.Visible then
  30. elseif main.Visible then
  31. end;
  32. elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  33. dragging = true
  34. draggableStart = input.Position
  35. startPos = main.AbsolutePosition
  36. elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  37. game:GetService("TweenService"):Create(main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(25, 25, 25)}):Play()
  38. end
  39. end)
  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 = ScreenGui.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. tile.Name = "tile"
  56. tile.Parent = main
  57. tile.BackgroundColor3 = Color3.new(1, 1, 1)
  58. tile.BackgroundTransparency = 1
  59. tile.Size = UDim2.new(0, 250, 0, 38)
  60. tile.Font = Enum.Font.SourceSans
  61. tile.Text = "Không Biết Làm Uilib"
  62. tile.TextColor3 = Color3.new(1, 1, 1)
  63. tile.TextScaled = true
  64. tile.TextSize = 14
  65. tile.TextWrapped = true
  66.  
  67. local GamerLibrary = {}
  68.  
  69. backgroup.Name = "backgroup"
  70. backgroup.Parent = main
  71. backgroup.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
  72. backgroup.BorderColor3 = Color3.new(1, 1, 1)
  73. backgroup.Position = UDim2.new(0, 0, 1, 0)
  74. backgroup.Size = UDim2.new(0, 250, 0, 181)
  75.  
  76. UIListLayout.Parent = backgroup
  77. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  78.  
  79. function GamerLibrary:NewSlider(tile, callback, max, min, startpoint)
  80.  
  81. local framr = Instance.new("Frame")
  82. local framn = Instance.new("Frame")
  83. local TextLabel = Instance.new("TextLabel")
  84.  
  85. framr.Name = "framr"
  86. framr.Parent = backgroup
  87. framr.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
  88. framr.BorderColor3 = Color3.new(1, 1, 1)
  89. framr.Position = UDim2.new(0.0560000017, 0, 0.0718232021, 0)
  90. framr.Size = UDim2.new(0, 222, 0, 36)
  91.  
  92. framn.Name = "framn"
  93. framn.Parent = framr
  94. framn.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
  95. framn.BorderSizePixel = 0
  96. framn.Size = UDim2.new((startpoint or 0) / max, 0, 0, 36)
  97.  
  98. TextLabel.Parent = framr
  99. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  100. TextLabel.BackgroundTransparency = 1
  101. TextLabel.Size = UDim2.new(0, 222, 0, 36)
  102. TextLabel.Font = Enum.Font.SourceSans
  103. TextLabel.Text = tile .. tostring(startpoint and math.floor((startpoint / max) * (max - min) + min) or 0)
  104. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  105. TextLabel.TextScaled = true
  106. TextLabel.TextSize = 14
  107. TextLabel.TextWrapped = true
  108. TextLabel.TextXAlignment = Enum.TextXAlignment.Left
  109.  
  110.  
  111. local dragging = false
  112.  
  113. local function slide(input)
  114. local pos = UDim2.new(math.clamp((input.Position.X - framr.AbsolutePosition.X) / framr.AbsoluteSize.X, 0, 1), 0, 1, 0)
  115. framn:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
  116. local value = math.floor(((pos.X.Scale * max) / max) * (max - min) + min)
  117. TextLabel.Text = tile .. tostring(value)
  118. callback(value)
  119. end;
  120.  
  121. framr.InputBegan:Connect(function(input)
  122. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  123. dragging = true
  124. end
  125. end)
  126.  
  127. framr.InputEnded:Connect(function(input)
  128. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  129. dragging = false
  130. end
  131. end)
  132.  
  133. framr.InputBegan:Connect(function(input)
  134. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  135. slide(input)
  136. end
  137. end)
  138.  
  139. game:GetService("UserInputService").InputChanged:Connect(function(input)
  140. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  141. slide(input)
  142. end
  143. end)
  144.  
  145. end
  146.  
  147. return GamerLibrary
  148. end
  149.  
  150. return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement