Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UILibrary = {}
- local function addCorner(instance, radius)
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, radius)
- corner.Parent = instance
- end
- function UILibrary.CreateGUI()
- local CoreGui = game:GetService("CoreGui")
- local existingGui = CoreGui:FindFirstChild("fff")
- if existingGui then
- existingGui:Destroy()
- end
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "fff"
- screenGui.Parent = CoreGui
- local MainFrame = Instance.new("Frame")
- MainFrame.Size = UDim2.new(0, 400, 0, 300)
- MainFrame.Position = UDim2.new(0.5, -200, 0.5, -150)
- MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- MainFrame.BackgroundTransparency = 0.6
- MainFrame.Active = true
- MainFrame.Visible = false
- MainFrame.Parent = screenGui
- addCorner(MainFrame, 10)
- local topFrame = Instance.new("Frame")
- topFrame.Size = UDim2.new(1, 0, 0, 40)
- topFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- topFrame.Parent = MainFrame
- addCorner(topFrame, 10)
- local title = Instance.new("TextLabel")
- title.Size = UDim2.new(0, 200, 0, 40)
- title.Position = UDim2.new(0, 1, 0, 0)
- title.Text = "Title Here"
- title.TextColor3 = Color3.fromRGB(255, 255, 255)
- title.Font = Enum.Font.Gotham
- title.TextSize = 14
- title.BackgroundTransparency = 1
- title.Parent = topFrame
- local description = Instance.new("TextLabel")
- description.Size = UDim2.new(0, 150, 0, 40)
- description.Position = UDim2.new(0, 140, 0, 0)
- description.Text = "Description Here"
- description.TextColor3 = Color3.fromRGB(169, 169, 169)
- description.Font = Enum.Font.Gotham
- description.TextSize = 12
- description.BackgroundTransparency = 1
- description.Parent = topFrame
- local closeButton = Instance.new("TextButton")
- closeButton.Size = UDim2.new(0, 40, 0, 40)
- closeButton.Position = UDim2.new(1, -50, 0, 0)
- closeButton.Text = "X"
- closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- closeButton.Font = Enum.Font.Gotham
- closeButton.TextSize = 20
- closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- closeButton.BackgroundTransparency = 0.6
- closeButton.Parent = topFrame
- addCorner(closeButton, 10)
- local minimizeButton = Instance.new("TextButton")
- minimizeButton.Size = UDim2.new(0, 40, 0, 40)
- minimizeButton.Position = UDim2.new(1, -100, 0, 0)
- minimizeButton.Text = "_"
- minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- minimizeButton.Font = Enum.Font.Gotham
- minimizeButton.TextSize = 20
- minimizeButton.BackgroundColor3 = Color3.fromRGB(255, 255, 0)
- minimizeButton.BackgroundTransparency = 0.6
- minimizeButton.Parent = topFrame
- addCorner(minimizeButton, 10)
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(0, 50, 0, 50)
- toggleButton.Position = UDim2.new(0, 10, 0, 10)
- toggleButton.Text = "Show Menu"
- toggleButton.Font = Enum.Font.Gotham
- toggleButton.TextSize = 12
- toggleButton.Active = true
- toggleButton.Draggable = true
- toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- toggleButton.BackgroundTransparency = 0.6
- toggleButton.Parent = screenGui
- addCorner(toggleButton, 10)
- toggleButton.MouseButton1Click:Connect(function()
- MainFrame.Visible = not MainFrame.Visible
- toggleButton.Text = MainFrame.Visible and "Hide Menu" or "Show Menu"
- end)
- closeButton.MouseButton1Click:Connect(function()
- MainFrame:Destroy()
- toggleButton:Destroy()
- end)
- local isMinimized = false
- minimizeButton.MouseButton1Click:Connect(function()
- if isMinimized then
- MainFrame.Size = UDim2.new(0, 400, 0, 300)
- scrollFrame = true
- isMinimized = false
- else
- MainFrame.Size = UDim2.new(0, 400, 0, 40)
- scrollFrame = false
- isMinimized = true
- end
- end)
- function UILibrary.UpdateTitleAndDescription(newTitle, newDescription)
- title.Text = newTitle
- description.Text = newDescription
- end
- local ExtraFrame = Instance.new("Frame")
- ExtraFrame.Size = UDim2.new(0, 200, 0, 300)
- ExtraFrame.Position = UDim2.new(0, -210, 0, 0)
- ExtraFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
- ExtraFrame.BackgroundTransparency = 0.6
- ExtraFrame.Visible = false
- ExtraFrame.Parent = MainFrame
- addCorner(ExtraFrame, 10)
- local scrollFrame = Instance.new("ScrollingFrame")
- scrollFrame.Size = UDim2.new(1, 0, 1, -10)
- scrollFrame.Position = UDim2.new(0, 0, 0, 5)
- scrollFrame.ScrollBarThickness = 10
- scrollFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- scrollFrame.BackgroundTransparency = 0.6
- scrollFrame.Parent = ExtraFrame
- local UIListLayout = Instance.new("UIListLayout")
- UIListLayout.Padding = UDim.new(0, 10)
- UIListLayout.Parent = scrollFrame
- UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
- scrollFrame.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y)
- end)
- local toggleExtraButton = Instance.new("TextButton")
- toggleExtraButton.Size = UDim2.new(0, 40, 0, 40)
- toggleExtraButton.Position = UDim2.new(0, -45, 0.5, -20)
- toggleExtraButton.Text = ">"
- toggleExtraButton.Font = Enum.Font.Gotham
- toggleExtraButton.TextSize = 20
- toggleExtraButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleExtraButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- toggleExtraButton.Parent = MainFrame
- addCorner(toggleExtraButton, 10)
- toggleExtraButton.MouseButton1Click:Connect(function()
- ExtraFrame.Visible = not ExtraFrame.Visible
- toggleExtraButton.Text = ExtraFrame.Visible and "<" or ">"
- end)
- local scrollFrame = Instance.new("ScrollingFrame")
- scrollFrame.Size = UDim2.new(1, 0, 1, -50)
- scrollFrame.Position = UDim2.new(0, 0, 0, 40)
- scrollFrame.ScrollBarThickness = 10
- scrollFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- scrollFrame.BackgroundTransparency = 0.6
- scrollFrame.Parent = MainFrame
- local UIListLayout = Instance.new("UIListLayout")
- UIListLayout.Padding = UDim.new(0, 10)
- UIListLayout.FillDirection = Enum.FillDirection.Vertical
- UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- UIListLayout.Parent = scrollFrame
- UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
- scrollFrame.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y)
- end)
- return {
- ScreenGui = screenGui,
- MainFrame = MainFrame,
- ExtraFrame = ExtraFrame,
- ScrollFrame = scrollFrame,
- }
- end
- function UILibrary.CreateSection(scrollParent, titleText)
- local sectionFrame = Instance.new("Frame")
- sectionFrame.Size = UDim2.new(0.9, 0, 0, 40)
- sectionFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- sectionFrame.BackgroundTransparency = 0.5
- sectionFrame.Parent = scrollParent
- addCorner(sectionFrame, 8)
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Size = UDim2.new(1, -20, 0, 20)
- titleLabel.Position = UDim2.new(0, 10, 0, 5)
- titleLabel.Font = Enum.Font.Gotham
- titleLabel.Text = titleText
- titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- titleLabel.TextSize = 14
- titleLabel.TextXAlignment = Enum.TextXAlignment.Left
- titleLabel.BackgroundTransparency = 1
- titleLabel.Parent = sectionFrame
- local contentFrame = Instance.new("Frame")
- contentFrame.Size = UDim2.new(1, -10, 0, 0)
- contentFrame.Position = UDim2.new(0, 5, 0, 25)
- contentFrame.BackgroundTransparency = 1
- contentFrame.Parent = sectionFrame
- local layout = Instance.new("UIListLayout")
- layout.Padding = UDim.new(0, 5)
- layout.FillDirection = Enum.FillDirection.Vertical
- layout.Parent = contentFrame
- layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
- contentFrame.Size = UDim2.new(1, -10, 0, layout.AbsoluteContentSize.Y)
- sectionFrame.Size = UDim2.new(0.9, 0, 0, layout.AbsoluteContentSize.Y + 30)
- end)
- return {
- Frame = contentFrame,
- AddElement = function(self, element)
- element.Parent = contentFrame
- end
- }
- end
- function UILibrary.CreateLabel(parent, text)
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(0, 200, 0, 40)
- label.Text = text
- label.Font = Enum.Font.Gotham
- label.TextSize = 14
- label.TextColor3 = Color3.fromRGB(255, 255, 255)
- label.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- label.BackgroundTransparency = 1
- label.Parent = parent
- addCorner(label, 10)
- return label
- end
- function UILibrary.CreateDropdown(parent, options, defaultOption, callback)
- local dropdownFrame = Instance.new("Frame")
- dropdownFrame.Size = UDim2.new(0, 200, 0, 30)
- dropdownFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- dropdownFrame.BackgroundTransparency = 0.6
- dropdownFrame.Parent = parent
- addCorner(dropdownFrame, 10)
- local dropdownButton = Instance.new("TextButton")
- dropdownButton.Size = UDim2.new(1, 0, 1, 0)
- dropdownButton.Text = "Select: " .. defaultOption
- dropdownButton.Font = Enum.Font.Gotham
- dropdownButton.TextSize = 14
- dropdownButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- dropdownButton.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- dropdownButton.BackgroundTransparency = 0.6
- dropdownButton.Parent = dropdownFrame
- addCorner(dropdownButton, 10)
- local dropdownMenu = Instance.new("Frame")
- dropdownMenu.Size = UDim2.new(1, 0, 0, 150)
- dropdownMenu.Position = UDim2.new(0, 0, 1, 0)
- dropdownMenu.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- dropdownMenu.BackgroundTransparency = 0.5
- dropdownMenu.Visible = false
- dropdownMenu.ZIndex = 10
- dropdownMenu.Parent = dropdownFrame
- addCorner(dropdownMenu, 10)
- local UIListLayoutDropdown = Instance.new("UIListLayout")
- UIListLayoutDropdown.Padding = UDim.new(0, 5)
- UIListLayoutDropdown.FillDirection = Enum.FillDirection.Vertical
- UIListLayoutDropdown.Parent = dropdownMenu
- for _, option in ipairs(options) do
- local optionButton = Instance.new("TextButton")
- optionButton.Size = UDim2.new(1, 0, 0, 25)
- optionButton.Text = option
- optionButton.Font = Enum.Font.Gotham
- optionButton.TextSize = 14
- optionButton.ZIndex = 11
- optionButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- optionButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- optionButton.BackgroundTransparency = 0.6
- optionButton.Parent = dropdownMenu
- addCorner(optionButton, 5)
- optionButton.MouseButton1Click:Connect(function()
- dropdownButton.Text = "Select: " .. option
- dropdownMenu.Visible = false
- callback(option)
- end)
- end
- dropdownButton.MouseButton1Click:Connect(function()
- dropdownMenu.Visible = not dropdownMenu.Visible
- end)
- end
- function UILibrary.CreateTextbox(parent, name, default, callback)
- local textboxFrame = Instance.new("Frame")
- textboxFrame.Size = UDim2.new(0, 260, 0, 40) -- Aumenté el ancho del frame
- textboxFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- textboxFrame.BackgroundTransparency = 0.4
- textboxFrame.Parent = parent
- addCorner(textboxFrame, 10)
- local textboxLabel = Instance.new("TextLabel")
- textboxLabel.Size = UDim2.new(0, 140, 1, 0) -- Aumenté el ancho del label
- textboxLabel.Text = name .. ":"
- textboxLabel.Font = Enum.Font.Gotham
- textboxLabel.TextSize = 13
- textboxLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- textboxLabel.BackgroundTransparency = 1
- textboxLabel.Parent = textboxFrame
- local textbox = Instance.new("TextBox")
- textbox.Size = UDim2.new(0, 100, 1, -10)
- textbox.Position = UDim2.new(0, 150, 0, 5) -- Ajusté la posición del textbox
- textbox.Text = tostring(default)
- textbox.Font = Enum.Font.Gotham
- textbox.TextSize = 14
- textbox.TextColor3 = Color3.fromRGB(255, 255, 255)
- textbox.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- textbox.BackgroundTransparency = 0.4
- textbox.Parent = textboxFrame
- addCorner(textbox, 10)
- textbox.FocusLost:Connect(function()
- local value = tonumber(textbox.Text)
- if value then
- callback(value)
- else
- textbox.Text = tostring(default)
- end
- end)
- end
- function UILibrary.CreateToggleButton(parent, name, defaultState, callback)
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(0, 200, 0, 30)
- toggleButton.Text = name .. ": " .. (defaultState and "ON" or "OFF")
- toggleButton.Font = Enum.Font.Gotham
- toggleButton.TextSize = 14
- toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleButton.BackgroundColor3 = defaultState and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- toggleButton.BackgroundTransparency = 0.6
- toggleButton.Parent = parent
- addCorner(toggleButton, 5)
- toggleButton.MouseButton1Click:Connect(function()
- local state = not (toggleButton.Text:find("ON") and true or false)
- toggleButton.Text = name .. ": " .. (state and "ON" or "OFF")
- toggleButton.BackgroundColor3 = state and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- callback(state)
- end)
- end
- function UILibrary.CreateColorPicker(parent, name, defaultColor, callback)
- local colorPickerFrame = Instance.new("Frame")
- colorPickerFrame.Size = UDim2.new(0, 260, 0, 40) -- Aumenté el ancho del frame
- colorPickerFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- colorPickerFrame.BackgroundTransparency = 0.4
- colorPickerFrame.Parent = parent
- addCorner(colorPickerFrame, 10)
- local colorPickerLabel = Instance.new("TextLabel")
- colorPickerLabel.Size = UDim2.new(0, 140, 1, 0) -- Aumenté el ancho del label
- colorPickerLabel.Text = name .. ":"
- colorPickerLabel.Font = Enum.Font.Gotham
- colorPickerLabel.TextSize = 15
- colorPickerLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- colorPickerLabel.BackgroundTransparency = 1
- colorPickerLabel.Parent = colorPickerFrame
- local colorPreview = Instance.new("Frame")
- colorPreview.Size = UDim2.new(0, 50, 0, 20)
- colorPreview.Position = UDim2.new(0, 150, 0.5, -10) -- Ajusté la posición
- colorPreview.BackgroundColor3 = defaultColor
- colorPreview.Parent = colorPickerFrame
- addCorner(colorPreview, 5)
- local colorPickerButton = Instance.new("TextButton")
- colorPickerButton.Size = UDim2.new(0, 30, 0, 20)
- colorPickerButton.Position = UDim2.new(0, 210, 0.5, -10) -- Ajusté la posición
- colorPickerButton.Text = "..."
- colorPickerButton.Font = Enum.Font.Gotham
- colorPickerButton.TextSize = 14
- colorPickerButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- colorPickerButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- colorPickerButton.BackgroundTransparency = 0.6
- colorPickerButton.Parent = colorPickerFrame
- addCorner(colorPickerButton, 5)
- local colorPickerGui = Instance.new("ScreenGui")
- colorPickerGui.Name = "ColorPickerGui"
- colorPickerGui.Parent = parent.Parent
- local colorPickerPopup = Instance.new("Frame")
- colorPickerPopup.Size = UDim2.new(0, 200, 0, 200)
- colorPickerPopup.Position = UDim2.new(0.5, -100, 0.5, -100)
- colorPickerPopup.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- colorPickerPopup.BackgroundTransparency = 0.6
- colorPickerPopup.Visible = false
- colorPickerPopup.Parent = colorPickerGui
- addCorner(colorPickerPopup, 10)
- local colorWheel = Instance.new("ImageLabel")
- colorWheel.Size = UDim2.new(0, 150, 0, 150)
- colorWheel.Position = UDim2.new(0.5, -75, 0.5, -75)
- colorWheel.Image = "rbxassetid://142488478"
- colorWheel.BackgroundTransparency = 1
- colorWheel.Active = true
- colorWheel.Parent = colorPickerPopup
- local colorSelector = Instance.new("Frame")
- colorSelector.Size = UDim2.new(0, 10, 0, 10)
- colorSelector.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- colorSelector.BorderSizePixel = 2
- colorSelector.Parent = colorWheel
- colorSelector.Active = true
- addCorner(colorSelector, 5)
- local confirmButton = Instance.new("TextButton")
- confirmButton.Size = UDim2.new(0, 80, 0, 30)
- confirmButton.Position = UDim2.new(0.5, -40, 1, -40)
- confirmButton.Text = "Confirm"
- confirmButton.Font = Enum.Font.Gotham
- confirmButton.TextSize = 14
- confirmButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- confirmButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- confirmButton.BackgroundTransparency = 0.6
- confirmButton.Parent = colorPickerPopup
- addCorner(confirmButton, 5)
- colorPickerButton.MouseButton1Click:Connect(function()
- colorPickerPopup.Visible = true
- end)
- local function updateColor(input)
- local mousePosition = input.Position
- local relativePosition = colorWheel.AbsolutePosition
- local x = (mousePosition.X - relativePosition.X) / colorWheel.AbsoluteSize.X
- local y = (mousePosition.Y - relativePosition.Y) / colorWheel.AbsoluteSize.Y
- x = math.clamp(x, 0, 1)
- y = math.clamp(y, 0, 1)
- colorSelector.Position = UDim2.new(x, -5, y, -5)
- local color = Color3.fromHSV(x, 1 - y, 1)
- colorPreview.BackgroundColor3 = color
- end
- colorWheel.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- updateColor(input)
- local connection
- connection = input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- connection:Disconnect()
- else
- updateColor(input)
- end
- end)
- end
- end)
- confirmButton.MouseButton1Click:Connect(function()
- colorPickerPopup.Visible = false
- callback(colorPreview.BackgroundColor3)
- end)
- end
- function UILibrary.CreateSlider(parent, name, minValue, maxValue, defaultValue, increment, callback)
- local sliderFrame = Instance.new("Frame")
- sliderFrame.Size = UDim2.new(0, 200, 0, 50)
- sliderFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- sliderFrame.BackgroundTransparency = 0.6
- sliderFrame.Parent = parent
- addCorner(sliderFrame, 10)
- local sliderLabel = Instance.new("TextLabel")
- sliderLabel.Size = UDim2.new(0, 100, 0, 20)
- sliderLabel.Position = UDim2.new(0, 10, 0, 5)
- sliderLabel.Text = name .. ": " .. defaultValue
- sliderLabel.Font = Enum.Font.Gotham
- sliderLabel.TextSize = 14
- sliderLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- sliderLabel.BackgroundTransparency = 1
- sliderLabel.Parent = sliderFrame
- local sliderTrack = Instance.new("Frame")
- sliderTrack.Size = UDim2.new(0, 180, 0, 5)
- sliderTrack.Position = UDim2.new(0, 10, 0, 30)
- sliderTrack.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- sliderTrack.Parent = sliderFrame
- addCorner(sliderTrack, 5)
- local sliderThumb = Instance.new("Frame")
- sliderThumb.Size = UDim2.new(0, 10, 0, 15)
- sliderThumb.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- sliderThumb.Parent = sliderTrack
- addCorner(sliderThumb, 5)
- local function round(value, decimalPlaces)
- local factor = 10 ^ decimalPlaces
- return math.floor(value * factor + 0.5) / factor
- end
- local function updateSlider(input)
- local mousePosition = input.Position
- local relativePosition = sliderTrack.AbsolutePosition
- local x = (mousePosition.X - relativePosition.X) / sliderTrack.AbsoluteSize.X
- x = math.clamp(x, 0, 1)
- local rawValue = minValue + (maxValue - minValue) * x
- local value = round(rawValue - (rawValue % increment), 2) -- Redondear al incremento más cercano
- value = math.clamp(value, minValue, maxValue)
- local thumbPosition = (value - minValue) / (maxValue - minValue)
- sliderThumb.Position = UDim2.new(thumbPosition, -5, 0.5, -7.5)
- sliderLabel.Text = name .. ": " .. value
- callback(value)
- end
- sliderTrack.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- updateSlider(input)
- local connection
- connection = input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- connection:Disconnect()
- else
- updateSlider(input)
- end
- end)
- end
- end)
- local initialValue = round(defaultValue - (defaultValue % increment), 2)
- local initialX = (initialValue - minValue) / (maxValue - minValue)
- sliderThumb.Position = UDim2.new(initialX, -5, 0.5, -7.5)
- sliderLabel.Text = name .. ": " .. initialValue
- end
- return UILibrary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement