Advertisement
M0nkePr0

Linear

Dec 21st, 2022 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.97 KB | None | 0 0
  1. -- >>: Variables
  2.  
  3. local players = game:service('Players')
  4. local player = players.LocalPlayer
  5. local mouse = player:GetMouse()
  6. local run = game:service('RunService')
  7. local stepped = run.Stepped
  8.  
  9. local uis = game:GetService("UserInputService")
  10. local Value
  11.  
  12. local windowCount = 0
  13. local xOffset = 10
  14.  
  15. -- >>: Services
  16.  
  17. local UserInputService = game:GetService("UserInputService")
  18.  
  19. -- >>: GUI Functions
  20.  
  21. if game.CoreGui:FindFirstChild("Linear") then
  22. game.CoreGui:FindFirstChild("Linear"):Destroy()
  23. end
  24.  
  25. -->>: Tweening
  26.  
  27. local TweenService = game:GetService("TweenService")
  28. local TweenTime = 0.1
  29.  
  30. local GlobalTweenInfo = TweenInfo.new(TweenTime)
  31. local AlteredTweenInfo = TweenInfo.new(TweenTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  32.  
  33. local function Tween(GuiObject, Dictionary)
  34. local TweenBase = TweenService:Create(GuiObject, GlobalTweenInfo, Dictionary)
  35. TweenBase:Play()
  36. return TweenBase
  37. end
  38.  
  39. local function GetXY(GuiObject)
  40. local X, Y = mouse.X - GuiObject.AbsolutePosition.X, mouse.Y - GuiObject.AbsolutePosition.Y
  41. local MaxX, MaxY = GuiObject.AbsoluteSize.X, GuiObject.AbsoluteSize.Y
  42. X, Y = math.clamp(X, 0, MaxX), math.clamp(Y, 0, MaxY)
  43. return X, Y, X/MaxX, Y/MaxY
  44. end
  45.  
  46. -- >>: Library
  47.  
  48. local Library = {}
  49.  
  50. function Library:CreateLibrary()
  51.  
  52. local Linear = Instance.new("ScreenGui")
  53.  
  54. Linear.Name = "Linear"
  55. Linear.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  56. Linear.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  57. Linear.ResetOnSpawn = false
  58.  
  59. local CategoryHandler = {}
  60.  
  61. function CategoryHandler:NewCategory(Name, Icon)
  62.  
  63. windowCount = windowCount + 1
  64. local winCount = windowCount
  65. local zindex = winCount * 7
  66.  
  67. local Main = Instance.new("Frame")
  68. local Category = Instance.new("TextLabel")
  69. local CategoryPadding = Instance.new("UIPadding")
  70. local CategoryIcon = Instance.new("ImageLabel")
  71. local ModuleHolder = Instance.new("Frame")
  72. local ModuleListing = Instance.new("UIListLayout")
  73.  
  74. local function Dragify(obj)
  75. spawn(function()
  76. local minitial
  77. local initial
  78. local isdragging
  79. Category.InputBegan:Connect(function(input)
  80. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  81. isdragging = true
  82. minitial = input.Position
  83. initial = obj.Position
  84. local con
  85. con = stepped:Connect(function()
  86. if isdragging then
  87. local delta = Vector3.new(mouse.X, mouse.Y, 0) - minitial
  88. obj.Position = UDim2.new(initial.X.Scale, initial.X.Offset + delta.X, initial.Y.Scale, initial.Y.Offset + delta.Y)
  89. else
  90. con:Disconnect()
  91. end
  92. end)
  93. input.Changed:Connect(function()
  94. if input.UserInputState == Enum.UserInputState.End then
  95. isdragging = false
  96. end
  97. end)
  98. end
  99. end)
  100. end)
  101. end
  102.  
  103. Main.Name = "Main"
  104. Main.Parent = Linear
  105. Main.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
  106. Main.BorderSizePixel = 0
  107. Main.Position = UDim2.new(0, xOffset, 0, 20)
  108. Main.Size = UDim2.new(0, 180, 0, 0)
  109. Main.AutomaticSize = Enum.AutomaticSize.Y
  110. Dragify(Main)
  111.  
  112. xOffset = xOffset + 195
  113.  
  114. Category.Name = "Category"
  115. Category.Parent = Main
  116. Category.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  117. Category.BorderColor3 = Color3.fromRGB(35, 35, 35)
  118. Category.BorderSizePixel = 3
  119. Category.Size = UDim2.new(1, 0, 0, 30)
  120. Category.Font = Enum.Font.GothamBold
  121. Category.Text = Name
  122. Category.TextColor3 = Color3.fromRGB(255, 255, 255)
  123. Category.TextSize = 18.000
  124. Category.TextXAlignment = Enum.TextXAlignment.Left
  125.  
  126. CategoryPadding.Parent = Category
  127. CategoryPadding.PaddingLeft = UDim.new(0, 10)
  128.  
  129. CategoryIcon.Parent = Category
  130. CategoryIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  131. CategoryIcon.BackgroundTransparency = 1.000
  132. CategoryIcon.Position = UDim2.new(0.810410798, 0, 0.0554964617, 0)
  133. CategoryIcon.Size = UDim2.new(0, 25, 0, 25)
  134. CategoryIcon.Image = "rbxassetid://" .. tostring(Icon)
  135.  
  136. ModuleHolder.Name = "ModuleHolder"
  137. ModuleHolder.Parent = Main
  138. ModuleHolder.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
  139. ModuleHolder.BorderColor3 = Color3.fromRGB(35, 35, 35)
  140. ModuleHolder.BorderSizePixel = 3
  141. ModuleHolder.Position = UDim2.new(0, 0, 0, 30)
  142. ModuleHolder.Size = UDim2.new(1, 0, 0, 0)
  143. ModuleHolder.AutomaticSize = Enum.AutomaticSize.Y
  144.  
  145. ModuleListing.Name = "ModuleListing"
  146. ModuleListing.Parent = ModuleHolder
  147. ModuleListing.HorizontalAlignment = Enum.HorizontalAlignment.Center
  148. ModuleListing.SortOrder = Enum.SortOrder.LayoutOrder
  149.  
  150. local ModuleHandler = {}
  151.  
  152. function ModuleHandler:NewModule(Name, default, Bind, callback)
  153.  
  154. local Module = Instance.new("TextButton")
  155. local ModulePadding = Instance.new("UIPadding")
  156. local Settings = Instance.new("Frame")
  157. local SettingsListing = Instance.new("UIListLayout")
  158.  
  159. local defaultLocal = default or false
  160. local ToggleInit = {}
  161.  
  162. local isHovering = false
  163.  
  164. Module.Name = "Module"
  165. Module.Parent = ModuleHolder
  166. Module.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
  167. Module.BorderSizePixel = 0
  168. Module.Size = UDim2.new(1, 0, 0, 30)
  169. Module.AutoButtonColor = false
  170. Module.Font = Enum.Font.Gotham
  171. Module.Text = Name
  172. Module.TextColor3 = Color3.fromRGB(255, 255, 255)
  173. Module.TextSize = 16.000
  174.  
  175. ModulePadding.Parent = Module
  176. ModulePadding.PaddingLeft = UDim.new(0, 7)
  177.  
  178. Settings.Name = "Settings"
  179. Settings.Parent = ModuleHolder
  180. Settings.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  181. Settings.BackgroundTransparency = 1.000
  182. Settings.Size = UDim2.new(1, 0, 0, 0)
  183. Settings.AutomaticSize = Enum.AutomaticSize.Y
  184. Settings.Visible = false
  185.  
  186. SettingsListing.Name = "SettingsListing"
  187. SettingsListing.Parent = Settings
  188. SettingsListing.HorizontalAlignment = Enum.HorizontalAlignment.Center
  189. SettingsListing.SortOrder = Enum.SortOrder.LayoutOrder
  190. SettingsListing.Padding = UDim.new(0, 2)
  191.  
  192. local SettingsEnabled = false
  193. local ToggleState = false
  194.  
  195. Module.MouseButton2Click:Connect(function()
  196. SettingsEnabled = not SettingsEnabled
  197. if SettingsEnabled then
  198. Settings.Visible = true
  199. else
  200. Settings.Visible = false
  201. end
  202. end)
  203.  
  204. local function SetState(State)
  205. if State then
  206. Module.BackgroundColor3 = Color3.fromRGB(73, 126, 118)
  207. elseif not State then
  208. Module.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
  209. end
  210. ToggleState = State
  211. callback(State)
  212. end
  213.  
  214. Module.MouseButton1Click:Connect(function()
  215. ToggleState = not ToggleState
  216. SetState(ToggleState)
  217. end)
  218.  
  219. if default == nil then
  220. function ToggleInit:SetState(State)
  221. SetState(State)
  222. end
  223. else
  224. SetState(defaultLocal)
  225. end
  226.  
  227. function ToggleInit:GetState(State)
  228. return ToggleState
  229. end
  230.  
  231. local KeybindInit = {}
  232. Bind = Bind or "None"
  233.  
  234. local WaitingForBind = false
  235. local Selected = Bind
  236. local Blacklist = {"W","A","S","D","Slash","Tab","Backspace","Escape","Space","Delete","Unknown","Backquote","Insert"}
  237.  
  238. local Keybind = Instance.new("TextButton")
  239. local KeybindPadding = Instance.new("UIPadding")
  240.  
  241. Keybind.Name = "Keybind"
  242. Keybind.Parent = Settings
  243. Keybind.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  244. Keybind.BackgroundTransparency = 1.000
  245. Keybind.BorderSizePixel = 0
  246. Keybind.Size = UDim2.new(1, 0, 0, 30)
  247. Keybind.Font = Enum.Font.Gotham
  248. Keybind.Text = "Keybind: " .. "None"
  249. Keybind.TextColor3 = Color3.fromRGB(255, 255, 255)
  250. Keybind.TextSize = 16.000
  251. Keybind.TextXAlignment = Enum.TextXAlignment.Left
  252.  
  253. KeybindPadding.Name = "KeybindPadding"
  254. KeybindPadding.Parent = Keybind
  255. KeybindPadding.PaddingLeft = UDim.new(0, 10)
  256.  
  257. Keybind.Visible = true
  258. Keybind.Text = "Keybind: " .. Bind
  259.  
  260. Keybind.MouseButton1Click:Connect(function()
  261. Keybind.Text = "Keybind: " .. "..."
  262. WaitingForBind = true
  263. end)
  264.  
  265. UserInputService.InputBegan:Connect(function(Input)
  266. if WaitingForBind and Input.UserInputType == Enum.UserInputType.Keyboard then
  267. local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
  268. if not table.find(Blacklist, Key) then
  269. Keybind.Text = "Keybind: " .. Key
  270. Selected = Key
  271. else
  272. Keybind.Text = "Keybind: " .. "None"
  273. Selected = "None"
  274. end
  275. WaitingForBind = false
  276. elseif Input.UserInputType == Enum.UserInputType.Keyboard then
  277. local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
  278. if Key == Selected then
  279. ToggleState = not ToggleState
  280. SetState(ToggleState)
  281. end
  282. end
  283. end)
  284.  
  285. function KeybindInit:SetBind(Key)
  286. Keybind.Text = "Keybind: " .. Key
  287. Selected = Key
  288. end
  289.  
  290. function KeybindInit:GetBind()
  291. return Selected
  292. end
  293.  
  294. function ModuleHandler:NewToggle(Name, default, callback)
  295.  
  296. local ThisToggle = default or false
  297.  
  298. local Toggle = Instance.new("TextLabel")
  299. local TogglePadding = Instance.new("UIPadding")
  300. local ToggleButton = Instance.new("TextButton")
  301. local ToggleButtonCorner = Instance.new("UICorner")
  302. local ToggleCircle = Instance.new("Frame")
  303. local ToggleCircleCorner = Instance.new("UICorner")
  304.  
  305. Toggle.Name = "Toggle"
  306. Toggle.Parent = Settings
  307. Toggle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  308. Toggle.BackgroundTransparency = 1.000
  309. Toggle.BorderSizePixel = 0
  310. Toggle.Size = UDim2.new(1, 0, 0, 30)
  311. Toggle.Font = Enum.Font.Gotham
  312. Toggle.Text = Name
  313. Toggle.TextColor3 = Color3.fromRGB(255, 255, 255)
  314. Toggle.TextSize = 16.000
  315. Toggle.TextXAlignment = Enum.TextXAlignment.Left
  316.  
  317. TogglePadding.Name = "TogglePadding"
  318. TogglePadding.Parent = Toggle
  319. TogglePadding.PaddingLeft = UDim.new(0, 10)
  320.  
  321. ToggleButton.Name = "ToggleButton"
  322. ToggleButton.Parent = Toggle
  323. ToggleButton.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  324. ToggleButton.BorderSizePixel = 0
  325. ToggleButton.Position = UDim2.new(0.703999996, 0, 0.189999998, 0)
  326. ToggleButton.Size = UDim2.new(0, 40, 0, 20)
  327. ToggleButton.AutoButtonColor = false
  328. ToggleButton.Font = Enum.Font.SourceSans
  329. ToggleButton.Text = ""
  330. ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  331. ToggleButton.TextSize = 14.000
  332.  
  333. ToggleButtonCorner.CornerRadius = UDim.new(0, 6)
  334. ToggleButtonCorner.Name = "ToggleButtonCorner"
  335. ToggleButtonCorner.Parent = ToggleButton
  336.  
  337. ToggleCircle.Name = "ToggleCircle"
  338. ToggleCircle.Parent = ToggleButton
  339. ToggleCircle.BackgroundColor3 = ThisToggle and Color3.fromRGB(73, 126, 118) or Color3.fromRGB(47, 47, 47)
  340. ToggleCircle.BorderSizePixel = 0
  341. ToggleCircle.Position = ThisToggle and UDim2.new(0.550000012, 0, 0.150000006, 0) or UDim2.new(0.100000001, 0, 0.150000006, 0)
  342. ToggleCircle.Size = UDim2.new(0, 14, 0, 14)
  343.  
  344. ToggleCircleCorner.CornerRadius = UDim.new(0, 4)
  345. ToggleCircleCorner.Name = "ToggleCircleCorner"
  346. ToggleCircleCorner.Parent = ToggleCircle
  347.  
  348. ToggleButton.MouseButton1Down:Connect(function()
  349. ThisToggle = not ThisToggle
  350. Tween(ToggleCircle, {BackgroundColor3 = ThisToggle and Color3.fromRGB(73, 126, 118) or Color3.fromRGB(47, 47, 47)})
  351. Tween(ToggleCircle, {Position = ThisToggle and UDim2.new(0.550000012, 0, 0.150000006, 0) or UDim2.new(0.100000001, 0, 0.150000006, 0)})
  352. callback(ThisToggle)
  353. end)
  354. end
  355.  
  356. function ModuleHandler:NewSlider(Name, minvalue, maxvalue, default, callback)
  357.  
  358. if minvalue > maxvalue then
  359. local StoreValue = minvalue
  360. minvalue = maxvalue
  361. maxvalue = StoreValue
  362. end
  363.  
  364. default = math.clamp(default, minvalue, maxvalue)
  365.  
  366. local defaultScale = default/maxvalue
  367.  
  368. local Slider = Instance.new("TextLabel")
  369. local SliderPadding = Instance.new("UIPadding")
  370. local SliderBackground = Instance.new("Frame")
  371. local SliderBackgroundCorner = Instance.new("UICorner")
  372. local SliderButton = Instance.new("TextButton")
  373. local SliderFill = Instance.new("Frame")
  374. local SliderFillCorner = Instance.new("UICorner")
  375.  
  376. Slider.Name = "Slider"
  377. Slider.Parent = Settings
  378. Slider.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  379. Slider.BackgroundTransparency = 1.000
  380. Slider.BorderSizePixel = 0
  381. Slider.Size = UDim2.new(1, 0, 0, 30)
  382. Slider.Font = Enum.Font.Gotham
  383. Slider.Text = Name..": "..tostring(default)
  384. Slider.TextColor3 = Color3.fromRGB(255, 255, 255)
  385. Slider.TextSize = 16.000
  386. Slider.TextXAlignment = Enum.TextXAlignment.Left
  387. Slider.TextYAlignment = Enum.TextYAlignment.Top
  388.  
  389. SliderPadding.Name = "SliderPadding"
  390. SliderPadding.Parent = Slider
  391. SliderPadding.PaddingLeft = UDim.new(0, 10)
  392. SliderPadding.PaddingTop = UDim.new(0, 1)
  393.  
  394. SliderBackground.Name = "SliderBackground"
  395. SliderBackground.Parent = Slider
  396. SliderBackground.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  397. SliderBackground.BorderSizePixel = 0
  398. SliderBackground.Position = UDim2.new(0, 0, 0.75, -1)
  399. SliderBackground.Size = UDim2.new(0.915882409, 0, 0, 6)
  400.  
  401. SliderBackgroundCorner.CornerRadius = UDim.new(0, 6)
  402. SliderBackgroundCorner.Name = "SliderBackgroundCorner"
  403. SliderBackgroundCorner.Parent = SliderBackground
  404.  
  405. SliderButton.Name = "SliderButton"
  406. SliderButton.Parent = SliderBackground
  407. SliderButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  408. SliderButton.BackgroundTransparency = 1.000
  409. SliderButton.BorderSizePixel = 0
  410. SliderButton.Size = UDim2.new(1, 0, 1, 0)
  411. SliderButton.Font = Enum.Font.SourceSans
  412. SliderButton.Text = ""
  413. SliderButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  414. SliderButton.TextSize = 14.000
  415.  
  416. SliderFill.Name = "SliderFill"
  417. SliderFill.Parent = SliderButton
  418. SliderFill.BackgroundColor3 = Color3.fromRGB(73, 126, 118)
  419. SliderFill.BorderSizePixel = 0
  420. SliderFill.Size = UDim2.new(defaultScale, 0, 1, 0)
  421.  
  422. SliderFillCorner.CornerRadius = UDim.new(0, 6)
  423. SliderFillCorner.Name = "SliderFillCorner"
  424. SliderFillCorner.Parent = SliderFill
  425.  
  426. SliderButton.MouseButton1Down:Connect(function()
  427. local X, Y, XScale, YScale = GetXY(SliderButton)
  428. local Value = math.floor(minvalue + ((maxvalue - minvalue) * XScale))
  429. callback(Value)
  430. Slider.Text = Name..": "..tostring(Value)
  431. local TargetSize = UDim2.new(XScale,0,1,0)
  432. Tween(SliderFill, {Size = TargetSize})
  433. local SliderMove, SliderKill
  434. SliderMove = mouse.Move:Connect(function()
  435. local X, Y, XScale, YScale = GetXY(SliderButton)
  436. local Value = math.floor(minvalue + ((maxvalue - minvalue) * XScale))
  437. callback(Value)
  438. Slider.Text = Name..": "..tostring(Value)
  439. local TargetSize = UDim2.new(XScale,0,1,0)
  440. Tween(SliderFill, {Size = TargetSize})
  441. end)
  442. SliderKill = UserInputService.InputEnded:Connect(function(UserInput)
  443. if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then
  444. SliderMove:Disconnect()
  445. SliderKill:Disconnect()
  446. end
  447. end)
  448. end)
  449. end
  450. end
  451. return ModuleHandler
  452. end
  453. return CategoryHandler
  454. end
  455. return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement