Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- >>: Variables
- local players = game:service('Players')
- local player = players.LocalPlayer
- local mouse = player:GetMouse()
- local run = game:service('RunService')
- local stepped = run.Stepped
- local uis = game:GetService("UserInputService")
- local Value
- local windowCount = 0
- local xOffset = 10
- -- >>: Services
- local UserInputService = game:GetService("UserInputService")
- -- >>: GUI Functions
- if game.CoreGui:FindFirstChild("Linear") then
- game.CoreGui:FindFirstChild("Linear"):Destroy()
- end
- -->>: Tweening
- local TweenService = game:GetService("TweenService")
- local TweenTime = 0.1
- local GlobalTweenInfo = TweenInfo.new(TweenTime)
- local AlteredTweenInfo = TweenInfo.new(TweenTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
- local function Tween(GuiObject, Dictionary)
- local TweenBase = TweenService:Create(GuiObject, GlobalTweenInfo, Dictionary)
- TweenBase:Play()
- return TweenBase
- end
- local function GetXY(GuiObject)
- local X, Y = mouse.X - GuiObject.AbsolutePosition.X, mouse.Y - GuiObject.AbsolutePosition.Y
- local MaxX, MaxY = GuiObject.AbsoluteSize.X, GuiObject.AbsoluteSize.Y
- X, Y = math.clamp(X, 0, MaxX), math.clamp(Y, 0, MaxY)
- return X, Y, X/MaxX, Y/MaxY
- end
- -- >>: Library
- local Library = {}
- function Library:CreateLibrary()
- local Linear = Instance.new("ScreenGui")
- Linear.Name = "Linear"
- Linear.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- Linear.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- Linear.ResetOnSpawn = false
- local CategoryHandler = {}
- function CategoryHandler:NewCategory(Name, Icon)
- windowCount = windowCount + 1
- local winCount = windowCount
- local zindex = winCount * 7
- local Main = Instance.new("Frame")
- local Category = Instance.new("TextLabel")
- local CategoryPadding = Instance.new("UIPadding")
- local CategoryIcon = Instance.new("ImageLabel")
- local ModuleHolder = Instance.new("Frame")
- local ModuleListing = Instance.new("UIListLayout")
- local function Dragify(obj)
- spawn(function()
- local minitial
- local initial
- local isdragging
- Category.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- isdragging = true
- minitial = input.Position
- initial = obj.Position
- local con
- con = stepped:Connect(function()
- if isdragging then
- local delta = Vector3.new(mouse.X, mouse.Y, 0) - minitial
- obj.Position = UDim2.new(initial.X.Scale, initial.X.Offset + delta.X, initial.Y.Scale, initial.Y.Offset + delta.Y)
- else
- con:Disconnect()
- end
- end)
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- isdragging = false
- end
- end)
- end
- end)
- end)
- end
- Main.Name = "Main"
- Main.Parent = Linear
- Main.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
- Main.BorderSizePixel = 0
- Main.Position = UDim2.new(0, xOffset, 0, 20)
- Main.Size = UDim2.new(0, 180, 0, 0)
- Main.AutomaticSize = Enum.AutomaticSize.Y
- Dragify(Main)
- xOffset = xOffset + 195
- Category.Name = "Category"
- Category.Parent = Main
- Category.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- Category.BorderColor3 = Color3.fromRGB(35, 35, 35)
- Category.BorderSizePixel = 3
- Category.Size = UDim2.new(1, 0, 0, 30)
- Category.Font = Enum.Font.GothamBold
- Category.Text = Name
- Category.TextColor3 = Color3.fromRGB(255, 255, 255)
- Category.TextSize = 18.000
- Category.TextXAlignment = Enum.TextXAlignment.Left
- CategoryPadding.Parent = Category
- CategoryPadding.PaddingLeft = UDim.new(0, 10)
- CategoryIcon.Parent = Category
- CategoryIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- CategoryIcon.BackgroundTransparency = 1.000
- CategoryIcon.Position = UDim2.new(0.810410798, 0, 0.0554964617, 0)
- CategoryIcon.Size = UDim2.new(0, 25, 0, 25)
- CategoryIcon.Image = "rbxassetid://" .. tostring(Icon)
- ModuleHolder.Name = "ModuleHolder"
- ModuleHolder.Parent = Main
- ModuleHolder.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
- ModuleHolder.BorderColor3 = Color3.fromRGB(35, 35, 35)
- ModuleHolder.BorderSizePixel = 3
- ModuleHolder.Position = UDim2.new(0, 0, 0, 30)
- ModuleHolder.Size = UDim2.new(1, 0, 0, 0)
- ModuleHolder.AutomaticSize = Enum.AutomaticSize.Y
- ModuleListing.Name = "ModuleListing"
- ModuleListing.Parent = ModuleHolder
- ModuleListing.HorizontalAlignment = Enum.HorizontalAlignment.Center
- ModuleListing.SortOrder = Enum.SortOrder.LayoutOrder
- local ModuleHandler = {}
- function ModuleHandler:NewModule(Name, default, Bind, callback)
- local Module = Instance.new("TextButton")
- local ModulePadding = Instance.new("UIPadding")
- local Settings = Instance.new("Frame")
- local SettingsListing = Instance.new("UIListLayout")
- local defaultLocal = default or false
- local ToggleInit = {}
- local isHovering = false
- Module.Name = "Module"
- Module.Parent = ModuleHolder
- Module.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
- Module.BorderSizePixel = 0
- Module.Size = UDim2.new(1, 0, 0, 30)
- Module.AutoButtonColor = false
- Module.Font = Enum.Font.Gotham
- Module.Text = Name
- Module.TextColor3 = Color3.fromRGB(255, 255, 255)
- Module.TextSize = 16.000
- ModulePadding.Parent = Module
- ModulePadding.PaddingLeft = UDim.new(0, 7)
- Settings.Name = "Settings"
- Settings.Parent = ModuleHolder
- Settings.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Settings.BackgroundTransparency = 1.000
- Settings.Size = UDim2.new(1, 0, 0, 0)
- Settings.AutomaticSize = Enum.AutomaticSize.Y
- Settings.Visible = false
- SettingsListing.Name = "SettingsListing"
- SettingsListing.Parent = Settings
- SettingsListing.HorizontalAlignment = Enum.HorizontalAlignment.Center
- SettingsListing.SortOrder = Enum.SortOrder.LayoutOrder
- SettingsListing.Padding = UDim.new(0, 2)
- local SettingsEnabled = false
- local ToggleState = false
- Module.MouseButton2Click:Connect(function()
- SettingsEnabled = not SettingsEnabled
- if SettingsEnabled then
- Settings.Visible = true
- else
- Settings.Visible = false
- end
- end)
- local function SetState(State)
- if State then
- Module.BackgroundColor3 = Color3.fromRGB(73, 126, 118)
- elseif not State then
- Module.BackgroundColor3 = Color3.fromRGB(47, 47, 47)
- end
- ToggleState = State
- callback(State)
- end
- Module.MouseButton1Click:Connect(function()
- ToggleState = not ToggleState
- SetState(ToggleState)
- end)
- if default == nil then
- function ToggleInit:SetState(State)
- SetState(State)
- end
- else
- SetState(defaultLocal)
- end
- function ToggleInit:GetState(State)
- return ToggleState
- end
- local KeybindInit = {}
- Bind = Bind or "None"
- local WaitingForBind = false
- local Selected = Bind
- local Blacklist = {"W","A","S","D","Slash","Tab","Backspace","Escape","Space","Delete","Unknown","Backquote","Insert"}
- local Keybind = Instance.new("TextButton")
- local KeybindPadding = Instance.new("UIPadding")
- Keybind.Name = "Keybind"
- Keybind.Parent = Settings
- Keybind.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Keybind.BackgroundTransparency = 1.000
- Keybind.BorderSizePixel = 0
- Keybind.Size = UDim2.new(1, 0, 0, 30)
- Keybind.Font = Enum.Font.Gotham
- Keybind.Text = "Keybind: " .. "None"
- Keybind.TextColor3 = Color3.fromRGB(255, 255, 255)
- Keybind.TextSize = 16.000
- Keybind.TextXAlignment = Enum.TextXAlignment.Left
- KeybindPadding.Name = "KeybindPadding"
- KeybindPadding.Parent = Keybind
- KeybindPadding.PaddingLeft = UDim.new(0, 10)
- Keybind.Visible = true
- Keybind.Text = "Keybind: " .. Bind
- Keybind.MouseButton1Click:Connect(function()
- Keybind.Text = "Keybind: " .. "..."
- WaitingForBind = true
- end)
- UserInputService.InputBegan:Connect(function(Input)
- if WaitingForBind and Input.UserInputType == Enum.UserInputType.Keyboard then
- local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
- if not table.find(Blacklist, Key) then
- Keybind.Text = "Keybind: " .. Key
- Selected = Key
- else
- Keybind.Text = "Keybind: " .. "None"
- Selected = "None"
- end
- WaitingForBind = false
- elseif Input.UserInputType == Enum.UserInputType.Keyboard then
- local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
- if Key == Selected then
- ToggleState = not ToggleState
- SetState(ToggleState)
- end
- end
- end)
- function KeybindInit:SetBind(Key)
- Keybind.Text = "Keybind: " .. Key
- Selected = Key
- end
- function KeybindInit:GetBind()
- return Selected
- end
- function ModuleHandler:NewToggle(Name, default, callback)
- local ThisToggle = default or false
- local Toggle = Instance.new("TextLabel")
- local TogglePadding = Instance.new("UIPadding")
- local ToggleButton = Instance.new("TextButton")
- local ToggleButtonCorner = Instance.new("UICorner")
- local ToggleCircle = Instance.new("Frame")
- local ToggleCircleCorner = Instance.new("UICorner")
- Toggle.Name = "Toggle"
- Toggle.Parent = Settings
- Toggle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Toggle.BackgroundTransparency = 1.000
- Toggle.BorderSizePixel = 0
- Toggle.Size = UDim2.new(1, 0, 0, 30)
- Toggle.Font = Enum.Font.Gotham
- Toggle.Text = Name
- Toggle.TextColor3 = Color3.fromRGB(255, 255, 255)
- Toggle.TextSize = 16.000
- Toggle.TextXAlignment = Enum.TextXAlignment.Left
- TogglePadding.Name = "TogglePadding"
- TogglePadding.Parent = Toggle
- TogglePadding.PaddingLeft = UDim.new(0, 10)
- ToggleButton.Name = "ToggleButton"
- ToggleButton.Parent = Toggle
- ToggleButton.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- ToggleButton.BorderSizePixel = 0
- ToggleButton.Position = UDim2.new(0.703999996, 0, 0.189999998, 0)
- ToggleButton.Size = UDim2.new(0, 40, 0, 20)
- ToggleButton.AutoButtonColor = false
- ToggleButton.Font = Enum.Font.SourceSans
- ToggleButton.Text = ""
- ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
- ToggleButton.TextSize = 14.000
- ToggleButtonCorner.CornerRadius = UDim.new(0, 6)
- ToggleButtonCorner.Name = "ToggleButtonCorner"
- ToggleButtonCorner.Parent = ToggleButton
- ToggleCircle.Name = "ToggleCircle"
- ToggleCircle.Parent = ToggleButton
- ToggleCircle.BackgroundColor3 = ThisToggle and Color3.fromRGB(73, 126, 118) or Color3.fromRGB(47, 47, 47)
- ToggleCircle.BorderSizePixel = 0
- ToggleCircle.Position = ThisToggle and UDim2.new(0.550000012, 0, 0.150000006, 0) or UDim2.new(0.100000001, 0, 0.150000006, 0)
- ToggleCircle.Size = UDim2.new(0, 14, 0, 14)
- ToggleCircleCorner.CornerRadius = UDim.new(0, 4)
- ToggleCircleCorner.Name = "ToggleCircleCorner"
- ToggleCircleCorner.Parent = ToggleCircle
- ToggleButton.MouseButton1Down:Connect(function()
- ThisToggle = not ThisToggle
- Tween(ToggleCircle, {BackgroundColor3 = ThisToggle and Color3.fromRGB(73, 126, 118) or Color3.fromRGB(47, 47, 47)})
- Tween(ToggleCircle, {Position = ThisToggle and UDim2.new(0.550000012, 0, 0.150000006, 0) or UDim2.new(0.100000001, 0, 0.150000006, 0)})
- callback(ThisToggle)
- end)
- end
- function ModuleHandler:NewSlider(Name, minvalue, maxvalue, default, callback)
- if minvalue > maxvalue then
- local StoreValue = minvalue
- minvalue = maxvalue
- maxvalue = StoreValue
- end
- default = math.clamp(default, minvalue, maxvalue)
- local defaultScale = default/maxvalue
- local Slider = Instance.new("TextLabel")
- local SliderPadding = Instance.new("UIPadding")
- local SliderBackground = Instance.new("Frame")
- local SliderBackgroundCorner = Instance.new("UICorner")
- local SliderButton = Instance.new("TextButton")
- local SliderFill = Instance.new("Frame")
- local SliderFillCorner = Instance.new("UICorner")
- Slider.Name = "Slider"
- Slider.Parent = Settings
- Slider.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Slider.BackgroundTransparency = 1.000
- Slider.BorderSizePixel = 0
- Slider.Size = UDim2.new(1, 0, 0, 30)
- Slider.Font = Enum.Font.Gotham
- Slider.Text = Name..": "..tostring(default)
- Slider.TextColor3 = Color3.fromRGB(255, 255, 255)
- Slider.TextSize = 16.000
- Slider.TextXAlignment = Enum.TextXAlignment.Left
- Slider.TextYAlignment = Enum.TextYAlignment.Top
- SliderPadding.Name = "SliderPadding"
- SliderPadding.Parent = Slider
- SliderPadding.PaddingLeft = UDim.new(0, 10)
- SliderPadding.PaddingTop = UDim.new(0, 1)
- SliderBackground.Name = "SliderBackground"
- SliderBackground.Parent = Slider
- SliderBackground.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- SliderBackground.BorderSizePixel = 0
- SliderBackground.Position = UDim2.new(0, 0, 0.75, -1)
- SliderBackground.Size = UDim2.new(0.915882409, 0, 0, 6)
- SliderBackgroundCorner.CornerRadius = UDim.new(0, 6)
- SliderBackgroundCorner.Name = "SliderBackgroundCorner"
- SliderBackgroundCorner.Parent = SliderBackground
- SliderButton.Name = "SliderButton"
- SliderButton.Parent = SliderBackground
- SliderButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- SliderButton.BackgroundTransparency = 1.000
- SliderButton.BorderSizePixel = 0
- SliderButton.Size = UDim2.new(1, 0, 1, 0)
- SliderButton.Font = Enum.Font.SourceSans
- SliderButton.Text = ""
- SliderButton.TextColor3 = Color3.fromRGB(0, 0, 0)
- SliderButton.TextSize = 14.000
- SliderFill.Name = "SliderFill"
- SliderFill.Parent = SliderButton
- SliderFill.BackgroundColor3 = Color3.fromRGB(73, 126, 118)
- SliderFill.BorderSizePixel = 0
- SliderFill.Size = UDim2.new(defaultScale, 0, 1, 0)
- SliderFillCorner.CornerRadius = UDim.new(0, 6)
- SliderFillCorner.Name = "SliderFillCorner"
- SliderFillCorner.Parent = SliderFill
- SliderButton.MouseButton1Down:Connect(function()
- local X, Y, XScale, YScale = GetXY(SliderButton)
- local Value = math.floor(minvalue + ((maxvalue - minvalue) * XScale))
- callback(Value)
- Slider.Text = Name..": "..tostring(Value)
- local TargetSize = UDim2.new(XScale,0,1,0)
- Tween(SliderFill, {Size = TargetSize})
- local SliderMove, SliderKill
- SliderMove = mouse.Move:Connect(function()
- local X, Y, XScale, YScale = GetXY(SliderButton)
- local Value = math.floor(minvalue + ((maxvalue - minvalue) * XScale))
- callback(Value)
- Slider.Text = Name..": "..tostring(Value)
- local TargetSize = UDim2.new(XScale,0,1,0)
- Tween(SliderFill, {Size = TargetSize})
- end)
- SliderKill = UserInputService.InputEnded:Connect(function(UserInput)
- if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then
- SliderMove:Disconnect()
- SliderKill:Disconnect()
- end
- end)
- end)
- end
- end
- return ModuleHandler
- end
- return CategoryHandler
- end
- return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement