Advertisement
marcelslibrary

MainUI Slider

Oct 5th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. local screen = Instance.new("ScreenGui",game:GetService("CoreGui"))
  2. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  3. local mainui = {
  4. frames = 0;
  5. buttonsize = 20;
  6. t = true,
  7. }
  8.  
  9. local colors = {
  10. barcolor = Color3.fromRGB(170, 0, 127)
  11. }
  12.  
  13.  
  14.  
  15. function mainui:AddWindow(n,c)
  16. local top = Instance.new("Frame",screen)
  17. local bframe = Instance.new("Frame")
  18. local main = Instance.new("ImageLabel")
  19. local UIListLayout = Instance.new("UIListLayout",main)
  20. local bar = Instance.new("Frame")
  21. local text = Instance.new("TextLabel")
  22. local x = c or 0
  23.  
  24. top.Name = "top"
  25. top.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
  26. top.BorderSizePixel = 0
  27. top.Position = UDim2.new(0, 20+(210*self.frames), 0, 15)
  28. top.Size = UDim2.new(0, 200, 0, 39)
  29.  
  30. bframe.Name = "bframe"
  31. bframe.Parent = top
  32. bframe.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  33. bframe.BorderColor3 = Color3.new(0.666667, 0, 0.498039)
  34. bframe.BorderSizePixel = 0
  35. bframe.ClipsDescendants = true
  36. bframe.Position = UDim2.new(-0.00045085547, 0, 0.999999583, 0)
  37. bframe.Size = UDim2.new(0, 200, 0, (self.buttonsize*x))
  38.  
  39. main.Name = "main"
  40. main.Parent = bframe
  41. main.BackgroundColor3 = Color3.new(1, 1, 1)
  42. main.BackgroundTransparency = 1
  43. main.Position = UDim2.new(-7.59143717e-08, 0, -1.12196979e-07, 0)
  44. main.Size = UDim2.new(0, 907, 0, 833)
  45. main.Image = "rbxassetid://3343671401"
  46. main.ImageTransparency = 0.89999997615814
  47.  
  48. bar.Name = "bar"
  49. bar.Parent = top
  50. bar.BackgroundColor3 = Color3.new(0.666667, 0, 0.498039)
  51. bar.BorderSizePixel = 0
  52. bar.Position = UDim2.new(0, 0, 0.923076928, 0)
  53. bar.Size = UDim2.new(0, 200, 0, 3)
  54.  
  55. text.Name = "text"
  56. text.Parent = top
  57. text.BackgroundColor3 = Color3.new(1, 1, 1)
  58. text.BackgroundTransparency = 1
  59. text.Size = UDim2.new(0, 200, 0, 36)
  60. text.Font = Enum.Font.Code
  61. text.Text = n
  62. text.TextColor3 = Color3.new(1, 1, 1)
  63. text.TextSize = 18
  64. self.frames = self.frames +1
  65. return main
  66. end
  67.  
  68. function mainui:AddToggle(txt,p)
  69. local b = Instance.new("TextButton")
  70. local label = Instance.new("TextLabel")
  71.  
  72. b.Name = "b"
  73. b.Parent = p
  74. b.BackgroundTransparency = 1
  75. b.Size = UDim2.new(0, 200, 0, self.buttonsize)
  76. b.Font = Enum.Font.SourceSans
  77. b.Text = txt
  78. b.TextColor3 = Color3.new(1, 1, 1)
  79. b.TextSize = 16
  80. b.TextXAlignment = Enum.TextXAlignment.Left
  81.  
  82. label.Name = "label"
  83. label.Parent = b
  84. label.BackgroundTransparency = 1
  85. label.Position = UDim2.new(0.890547276, 0, 0, 0)
  86. label.Size = UDim2.new(0, 21, 0, 20)
  87. label.Font = Enum.Font.Code
  88. label.Text = "OFF"
  89. label.TextColor3 = Color3.new(1,0,0)
  90. label.TextSize = 14
  91. return b,label
  92. end
  93.  
  94. function mainui:AddBox(t,b,p)
  95. local a = Instance.new("TextBox")
  96.  
  97. a.Name = "a"
  98. a.Parent = p
  99. a.BackgroundColor3 = Color3.new(0.231373, 0.231373, 0.231373)
  100. a.BorderSizePixel = 0
  101. a.Size = UDim2.new(0, 200, 0, 20)
  102. a.Font = Enum.Font.SourceSans
  103. a.PlaceholderColor3 = Color3.new(1, 1, 1)
  104. a.Text = t
  105. a.PlaceholderText = b
  106. a.TextColor3 = Color3.new(1, 1, 1)
  107. a.TextSize = 16
  108. a.TextStrokeColor3 = Color3.new(1, 1, 1)
  109. a.TextXAlignment = Enum.TextXAlignment.Left
  110. a.TextTransparency = 0.4
  111. return a
  112. end
  113.  
  114. function mainui:AddButton(txt,p)
  115. local x = Instance.new("TextButton")
  116. x.Name = "x"
  117. x.Parent = p
  118. x.BackgroundTransparency = 1
  119. x.BorderSizePixel = 0
  120. x.Size = UDim2.new(0, 200, 0, 20)
  121. x.Font = Enum.Font.SourceSans
  122. x.Text = txt
  123. x.TextColor3 = Color3.new(1, 1, 1)
  124. x.TextSize = 16
  125. x.TextXAlignment = Enum.TextXAlignment.Left
  126. return x
  127. end
  128.  
  129. function mainui:AddText(txt,p)
  130. local x = Instance.new("TextLabel")
  131. x.Name = "x"
  132. x.Parent = p
  133. x.BackgroundTransparency = 1
  134. x.BorderSizePixel = 0
  135. x.Size = UDim2.new(0, 200, 0, 20)
  136. x.Font = Enum.Font.SourceSans
  137. x.Text = txt
  138. x.TextColor3 = Color3.new(1, 1, 1)
  139. x.TextSize = 16
  140. x.TextXAlignment = Enum.TextXAlignment.Left
  141. return x
  142. end
  143.  
  144. function mainui:AddSlider(txt,p)
  145. local SliderB = Instance.new("Frame")
  146. local Text = Instance.new("TextLabel")
  147. local Count = Instance.new("TextLabel")
  148. local Frame = Instance.new("Frame")
  149. local Background = Instance.new("Frame")
  150. local SliderObject = Instance.new("TextButton")
  151.  
  152. --Properties:
  153.  
  154. SliderB.Name = "SliderB"
  155. SliderB.Parent = p
  156. SliderB.BackgroundColor3 = Color3.new(0.203922, 0.203922, 0.203922)
  157. SliderB.BackgroundTransparency = 1
  158. SliderB.BorderSizePixel = 0
  159. SliderB.Position = UDim2.new(0.0989583284, 0, 0.404176891, 0)
  160. SliderB.Size = UDim2.new(0, 200, 0, 20)
  161.  
  162. Text.Name = txt
  163. Text.Parent = SliderB
  164. Text.BackgroundColor3 = Color3.new(1, 1, 1)
  165. Text.BackgroundTransparency = 1
  166. Text.BorderSizePixel = 0
  167. Text.Size = UDim2.new(0, 82, 0, 20)
  168. Text.Font = Enum.Font.SourceSans
  169. Text.TextColor3 = Color3.new(1, 1, 1)
  170. Text.TextSize = 16
  171. Text.TextWrapped = true
  172. Text.TextXAlignment = Enum.TextXAlignment.Left
  173.  
  174. Count.Name = "Count"
  175. Count.Parent = SliderB
  176. Count.BackgroundColor3 = Color3.new(1, 1, 1)
  177. Count.BackgroundTransparency = 1
  178. Count.Position = UDim2.new(0.399999976, 0, -0.0500000007, 0)
  179. Count.Size = UDim2.new(0, 20, 0, 20)
  180. Count.Font = Enum.Font.SourceSans
  181. Count.Text = "0"
  182. Count.TextColor3 = Color3.new(1, 1, 1)
  183. Count.TextSize = 16
  184.  
  185. Frame.Parent = SliderB
  186. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  187. Frame.BorderSizePixel = 0
  188. Frame.Position = UDim2.new(0.535000026, 0, 0.426315308, 0)
  189. Frame.Size = UDim2.new(0, 92, 0, 2)
  190.  
  191. Background.Name = "Background"
  192. Background.Parent = Frame
  193. Background.BackgroundColor3 = Color3.new(1, 1, 1)
  194. Background.BackgroundTransparency = 1
  195. Background.BorderColor3 = Color3.new(1, 1, 1)
  196. Background.BorderSizePixel = 0
  197. Background.Position = UDim2.new(1.0869565, -100, 0.736846924, -10)
  198. Background.Size = UDim2.new(0, 90, 0, 19)
  199.  
  200. SliderObject.Name = "SliderObject"
  201. SliderObject.Parent = Background
  202. SliderObject.BackgroundColor3 = Color3.new(0.666667, 0, 1)
  203. SliderObject.BorderColor3 = Color3.new(0, 0, 0)
  204. SliderObject.BorderSizePixel = 0
  205. SliderObject.Size = UDim2.new(0, 7, 1.05263078, 0)
  206. SliderObject.AutoButtonColor = false
  207. SliderObject.Font = Enum.Font.ArialBold
  208. SliderObject.Text = ""
  209. SliderObject.TextColor3 = Color3.new(0, 0, 0)
  210. SliderObject.TextScaled = true
  211. SliderObject.TextSize = 96
  212. SliderObject.TextWrapped = true
  213.  
  214.  
  215. local Container = Background
  216. local Slider = SliderObject
  217.  
  218. local Dragging
  219.  
  220. Slider.MouseButton1Down:connect(function()
  221. Dragging = true
  222. end)
  223.  
  224. mouse.Button1Up:connect(function()
  225. Dragging = false
  226. end)
  227.  
  228. local function ClampAndTweenPosition(Position)
  229. local FinalPosition = Position
  230. if (FinalPosition.X.Offset < 0) then
  231. FinalPosition = UDim2.new(0, 0, 0, 0)
  232. elseif (FinalPosition.X.Offset > Container.AbsoluteSize.X) then
  233. FinalPosition = UDim2.new(1, -Slider.AbsoluteSize.X, 0, 0)
  234. end
  235. Slider:TweenPosition(
  236. FinalPosition,
  237. Enum.EasingDirection.InOut,
  238. Enum.EasingStyle.Linear,
  239. 0.1,
  240. true
  241. )
  242. end
  243.  
  244. game:GetService("UserInputService").InputChanged:connect(function(InputObject, GameProcessedEvent)
  245. if ((not GameProcessedEvent) and Dragging) then
  246. if (InputObject.UserInputType == Enum.UserInputType.MouseMovement) then
  247. ClampAndTweenPosition(
  248. UDim2.new(
  249. 0,
  250. (InputObject.Position.X - Container.AbsolutePosition.X),
  251. 0,
  252. 0
  253. )
  254. )
  255. end
  256. end
  257. end)
  258.  
  259.  
  260. return SliderObject,Frame,Count
  261. end
  262.  
  263. function onKeyPress(actionName, userInputState, inputObject)
  264. if userInputState == Enum.UserInputState.Begin then
  265. if mainui.t == false then
  266. mainui.t = true
  267. screen.Enabled = true
  268. else
  269. mainui.t = false
  270. screen.Enabled = false
  271. end
  272. end
  273. end
  274.  
  275. game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.RightShift)
  276.  
  277.  
  278. return mainui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement