Forum > General >

[Help] How do i create sections for this ui lib?

Posts: 3

Threads: 1

Joined: May, 2022

Reputation: 0

Posted

Hi, i'm new in ui creating and i need to create sections for this

https://media.discordapp.net/attachments/906754487039959101/976207786071449620/unknown.png?width=760&height=427
code:

local Lib = {}

function Lib:CreateWindow(name) 
	local UIMain = Instance.new("ScreenGui")
	local MainFrame = Instance.new("Frame")
	local UICorner = Instance.new("UICorner")
	local TopbarFrame = Instance.new("Frame")
	local UICorner_2 = Instance.new("UICorner")
	local TextLabel = Instance.new("TextLabel")
	local Icon = Instance.new("ImageButton")
	local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
	local Border = Instance.new("Frame")
	local SectionFrame = Instance.new("Frame")
	local UIListLayout = Instance.new("UIListLayout")
	local UICorner_3 = Instance.new("UICorner")
	local WidgetFrame = Instance.new("Frame")
	local UICorner_4 = Instance.new("UICorner")
	local UIListLayout_2 = Instance.new("UIListLayout")
	local UserInputService = game:GetService("UserInputService")

    local gui = MainFrame

    local dragging
    local dragInput
    local dragStart
    local startPos

    local function update(input)
        local delta = input.Position - dragStart
        gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end

    TopbarFrame.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = gui.Position
            
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    TopbarFrame.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
            dragInput = input
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if input == dragInput and dragging then
            update(input)
        end
    end)
	local WidgetList  = {}
	
	function WidgetList:CreateButton(name)
		local SectionButton = Instance.new("TextButton")
		
		SectionButton.Name = "SectionButton"
		SectionButton.Parent = WidgetFrame
		SectionButton.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
		SectionButton.BorderSizePixel = 0
		SectionButton.Size = UDim2.new(0, 164, 0, 32)
		SectionButton.Font = Enum.Font.SciFi
		SectionButton.TextColor3 = Color3.fromRGB(255, 255, 255)
		SectionButton.TextSize = 14.000
		SectionButton.Text = name
	end
	
	
	UIMain.Name = "UIMain"
	UIMain.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
	UIMain.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

	MainFrame.Name = "MainFrame"
	MainFrame.Parent = UIMain
	MainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
	MainFrame.Position = UDim2.new(0.187043801, 0, 0.133200794, 0)
	MainFrame.Size = UDim2.new(0, 686, 0, 368)

	UICorner.CornerRadius = UDim.new(0, 5)
	UICorner.Parent = MainFrame

	TopbarFrame.Name = "TopbarFrame"
	TopbarFrame.Parent = MainFrame
	TopbarFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
	TopbarFrame.Size = UDim2.new(0, 686, 0, 24)
    TopbarFrame.Draggable = true
	UICorner_2.CornerRadius = UDim.new(0, 3)
	UICorner_2.Parent = TopbarFrame

	TextLabel.Parent = TopbarFrame
	TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
	TextLabel.BackgroundTransparency = 1.000
	TextLabel.BorderSizePixel = 0
	TextLabel.Position = UDim2.new(0.338192433, 0, 0, 0)
	TextLabel.Size = UDim2.new(0, 222, 0, 24)
	TextLabel.Font = Enum.Font.DenkOne
	TextLabel.TextColor3 = Color3.fromRGB(95, 95, 95)
	TextLabel.TextSize = 14.000
    TextLabel.Text = name

	Icon.Name = "Icon"
	Icon.Parent = TopbarFrame
	Icon.BackgroundTransparency = 1.000
	Icon.Position = UDim2.new(0.965014577, 0, 0, 0)
	Icon.Size = UDim2.new(0.043730963, 0, 1.00000083, 0)
	Icon.Image = "rbxassetid://7743878857"
	Icon.ImageColor3 = Color3.fromRGB(95, 95, 95)
    Icon.MouseButton1Click:Connect(function() 
        UIMain.Enabled = false
    end)

	UIAspectRatioConstraint.Parent = Icon

	Border.Name = "Border"
	Border.Parent = MainFrame
	Border.BackgroundColor3 = Color3.fromRGB(254, 55, 58)
	Border.BorderSizePixel = 0
	Border.Position = UDim2.new(0.00437317789, 0, 0.0624999776, 0)
	Border.Size = UDim2.new(0, 680, 0, 1)

	SectionFrame.Name = "SectionFrame"
	SectionFrame.Parent = MainFrame
	SectionFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
	SectionFrame.BorderSizePixel = 0
	SectionFrame.Position = UDim2.new(0.016034985, 0, 0.0869565234, 0)
	SectionFrame.Size = UDim2.new(0, 164, 0, 326)

	UIListLayout.Parent = SectionFrame
	UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder

	UICorner_3.Parent = SectionFrame

	WidgetFrame.Name = "WidgetFrame"
	WidgetFrame.Parent = MainFrame
	WidgetFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
	WidgetFrame.BorderSizePixel = 0
	WidgetFrame.Position = UDim2.new(0.268221587, 0, 0.0869565234, 0)
	WidgetFrame.Size = UDim2.new(0, 493, 0, 326)

	UICorner_4.Parent = WidgetFrame

	UIListLayout_2.Parent = WidgetFrame
	UIListLayout_2.FillDirection = Enum.FillDirection.Horizontal
	UIListLayout_2.SortOrder = Enum.SortOrder.LayoutOrder
	UIListLayout_2.Padding = UDim.new(0, 5)

	return WidgetList;	
end

local Window = Lib:CreateWindow("Text")
Window:CreateButton("teste")
  • 0

UI Designer, Pro Exploiter, Programmer

Posts: 150

Threads: 32

Joined: Apr, 2021

Reputation: 8

Replied

bro ion know do funni lua code or smth smh

  • 0

"r u alce" - pleb8000
"lets make stuff" - Immoon
https://cdn.discordapp.com/attachments/850904515858923590/921759578620825640/VortexAllias.png

Posts: 3

Threads: 1

Joined: May, 2022

Reputation: 0

Replied

@VortexAllias I didn't understand i'm not from US, can u write in readable language?

  • 0

Added

I just created an button parent to SectionFrame and it worked, thanks!
https://media.discordapp.net/attachments/906754487039959101/976295844854792292/unknown.png

  • 0

UI Designer, Pro Exploiter, Programmer

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )