0% found this document useful (0 votes)
13 views11 pages

Roblox GUI Library Overview

The document outlines a Lua script for creating a customizable GUI library in Roblox, featuring advanced functions for creating UI elements, animations, and themes. It includes functionality for draggable windows, scrollable frames, and tabbed interfaces with toggle buttons. The script also defines color themes and provides methods for adding and selecting tabs within the GUI.

Uploaded by

dincemirata
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views11 pages

Roblox GUI Library Overview

The document outlines a Lua script for creating a customizable GUI library in Roblox, featuring advanced functions for creating UI elements, animations, and themes. It includes functionality for draggable windows, scrollable frames, and tabbed interfaces with toggle buttons. The script also defines color themes and provides methods for adding and selecting tabs within the GUI.

Uploaded by

dincemirata
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local Library = {}

Library.__index = Library

local UserInputService = game:GetService("UserInputService")


local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local CoreGui = game:GetService("CoreGui")

-- Gelişmiş Create fonksiyonu


local function Create(class, props)
local obj = [Link](class)
if props then
for k,v in pairs(props) do
if k == "Parent" then
[Link] = v
else
local success, err = pcall(function()
obj[k] = v
end)
if not success then
if typeof(v) == "Color3" and (k == "BrickColor" or
k:lower():find("brickcolor")) then
[Link] = [Link](v)
else
error(err)
end
end
end
end
end
return obj
end

local function Tween(instance, properties, duration, style, direction)


style = style or [Link]
direction = direction or [Link]
local tweenInfo = [Link](duration, style, direction)
local tween = TweenService:Create(instance, tweenInfo, properties)
tween:Play()
return tween
end

local Themes = {
Default = {
Background = [Link](35,35,40),
Accent = [Link](120,90,255),
Text = [Link](230,230,230),
Section = [Link](45,45,50),
Hover = [Link](70,70,80),
ToggleOn = [Link](100,160,255),
ToggleOff = [Link](70,70,70),
DropdownBG = [Link](40,40,45),
SliderFill = [Link](100,160,255),
TextBoxBG = [Link](50,50,55),
ButtonBG = [Link](80,80,90),
OwnerTagBG = [Link](70, 70, 80),
OwnerTagText = [Link](180, 180, 180),
CloseBtnHover = [Link](255, 100, 100)
}
}

local Gui = Create("ScreenGui", {Name = "EmirGuiLib", ResetOnSpawn = false})


[Link] = CoreGui

local function MakeDraggable(frame, dragBar)


dragBar = dragBar or frame
local dragging = false
local dragInput, mousePos, framePos

local function waitForAbsoluteSize()


while [Link].X == 0 or [Link].Y == 0 do
[Link]:Wait()
end
end

[Link]:Connect(function(input)
if [Link] == [Link].MouseButton1 or
[Link] == [Link] then
waitForAbsoluteSize()

dragging = true
mousePos = [Link]
framePos = [Link]

[Link]:Connect(function()
if [Link] == [Link] then
dragging = false
end
end)
end
end)

[Link]:Connect(function(input)
if [Link] == [Link] or
[Link] == [Link] then
dragInput = input
end
end)

[Link]:Connect(function(input)
if input == dragInput and dragging then
local delta = [Link] - mousePos
local viewportSize = [Link]

local guiWidth = [Link].X


local guiHeight = [Link].Y

local newX = [Link] + delta.X


local newY = [Link] + delta.Y

newX = [Link](newX, 0, viewportSize.X - guiWidth)


newY = [Link](newY, 0, viewportSize.Y - guiHeight)

[Link] = [Link](0, newX, 0, newY)


end
end)
end
local function MakeScrollable(frame)
local scroll = Create("ScrollingFrame", {
Parent = frame,
BackgroundTransparency = 1,
Size = [Link](1, 0, 1, 0),
CanvasSize = [Link](0, 0, 0, 0),
ScrollBarThickness = 8,
ScrollBarImageColor3 = [Link],
VerticalScrollBarInset = [Link],
ZIndex = 5
})
local layout = Create("UIListLayout", {Parent = scroll, SortOrder =
[Link], Padding = [Link](0,6)})
local padding = Create("UIPadding", {Parent = scroll, PaddingTop =
[Link](0,6), PaddingBottom = [Link](0,6), PaddingLeft = [Link](0,6),
PaddingRight = [Link](0,6)})

layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
[Link] = [Link](0, 0, 0, [Link].Y + 6)
end)

return scroll
end

local Widget = {}
Widget.__index = Widget

local Window = {}
Window.__index = Window
setmetatable(Window, Widget)

function Window:new(title, ownerName)


local self = setmetatable({}, Window)

local viewport = [Link]


local initialWidth = [Link](viewport.X * 0.8, 350, 480)
local initialHeight = [Link](viewport.Y * 0.6, 250, 350)

[Link] = Create("Frame", {
Parent = Gui,
Size = [Link](0, initialWidth, 0, initialHeight),
Position = [Link](0.5, -initialWidth/2, 1, -initialHeight - 24),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ClipsDescendants = true,
ZIndex = 50
})

local mainCorner = [Link]("UICorner")


[Link] = [Link](0, 8)
[Link] = [Link]

[Link] = Create("Frame", {
Parent = [Link],
Size = [Link](1, 0, 0, 36),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ZIndex = 51
})
local titleCorner = [Link]("UICorner")
[Link] = [Link](0, 8)
[Link] = [Link]

[Link] = Create("TextLabel", {
Parent = [Link],
Text = title or "Emir GUI",
TextColor3 = [Link],
Font = [Link],
TextSize = 18,
BackgroundTransparency = 1,
Position = [Link](0, 12, 0, 0),
Size = [Link](1, -100, 1, 0),
TextXAlignment = [Link],
ZIndex = 52
})

[Link] = Create("TextLabel", {
Parent = [Link],
Text = ownerName or "Owner: Emir",
TextColor3 = [Link],
BackgroundColor3 = [Link],
Font = [Link],
TextSize = 12,
Size = [Link](0, 110, 0, 20),
Position = [Link](1, -116, 1, -24),
BorderSizePixel = 0,
TextXAlignment = [Link],
TextYAlignment = [Link],
ZIndex = 70,
ClipsDescendants = true
})
local ownerCorner = [Link]("UICorner", [Link])
[Link] = [Link](0, 6)

-- YATAY KAYDIRMA İÇİN SCROLLING FRAME


[Link] = Create("ScrollingFrame", {
Parent = [Link],
Position = [Link](0, 0, 0, 36),
Size = [Link](1, 0, 0, 30),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ScrollBarThickness = 4,
ScrollBarImageColor3 = [Link],
VerticalScrollBarInset = [Link],
ScrollingDirection = [Link].X,
CanvasSize = [Link](0, 0, 0, 0),
ZIndex = 52
})

-- TAB BUTONLARI İÇİN KONTEYNER


[Link] = Create("Frame", {
Parent = [Link],
Size = [Link](0, 0, 1, 0), -- Genişlik dinamik olarak ayarlanacak
BackgroundTransparency = 1,
ZIndex = 52
})
-- TABLARI YAN YANA DİZMEK İÇİN LAYOUT
[Link] = Create("UIListLayout", {
Parent = [Link],
FillDirection = [Link],
SortOrder = [Link],
Padding = [Link](0, 6)
})

-- TAB BUTONLARININ BOYUTU DEĞİŞTİĞİNDE CANVAS BOYUTUNU GÜNCELLE

[Link]:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function
()
local contentWidth = [Link].X
[Link] = [Link](0, contentWidth, 1, 0)
[Link] = [Link](0, contentWidth, 0, 0)
end)

[Link] = Create("Frame", {
Parent = [Link],
Position = [Link](0, 0, 0, 66),
Size = [Link](1, 0, 1, -66),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ClipsDescendants = true,
ZIndex = 51
})

[Link] = Create("TextButton", {
Parent = [Link],
Text = "—",
TextColor3 = [Link],
Font = [Link],
TextSize = 20,
BackgroundTransparency = 1,
Size = [Link](0, 36, 1, 0),
Position = [Link](1, -72, 0, 0),
ZIndex = 53,
AutoButtonColor = false
})

[Link] = Create("TextButton", {
Parent = [Link],
Text = "×",
TextColor3 = [Link],
Font = [Link],
TextSize = 24,
BackgroundTransparency = 1,
Size = [Link](0, 36, 1, 0),
Position = [Link](1, -36, 0, 0),
ZIndex = 53,
AutoButtonColor = false
})

[Link]:Connect(function()
Tween([Link], {TextColor3 = [Link]}, 0.15)
end)
[Link]:Connect(function()
Tween([Link], {TextColor3 = [Link]}, 0.15)
end)
[Link].MouseButton1Click:Connect(function()
Gui:Destroy()
end)

[Link] = false
local originalSize = [Link]

[Link]:Connect(function()
Tween([Link], {TextColor3 = [Link](180,180,180)}, 0.15)
end)
[Link]:Connect(function()
Tween([Link], {TextColor3 = [Link]}, 0.15)
end)
[Link].MouseButton1Click:Connect(function()
if not [Link] then
Tween([Link], {Size = [Link](0, [Link], 0, 36)},
0.3)
[Link] = false
[Link] = false
[Link] = false
[Link] = true
else
Tween([Link], {Size = originalSize}, 0.3)
[Link] = true
[Link] = true
[Link] = true
[Link] = false
end
end)

[Link] = {}
[Link] = nil

MakeDraggable([Link], [Link])

return self
end

function Window:AddTab(name)
assert(type(name) == "string", "Tab name must be string")

-- Tab butonunu TabListContainer'a ekle


local tabBtn = Create("TextButton", {
Parent = [Link],
Text = name,
BackgroundColor3 = [Link],
TextColor3 = [Link],
Font = [Link],
TextSize = 15,
AutoButtonColor = false,
Size = [Link](0, 110, 1, -6),
BorderSizePixel = 0,
ZIndex = 54
})

[Link] = [Link](0, 0, 0.5, 0)


[Link] = [Link](0, 0.5)

local tabCorner = [Link]("UICorner")


[Link] = [Link](0, 6)
[Link] = tabBtn

local tabContent = Create("Frame", {


Parent = [Link],
Size = [Link](1, 0, 1, 0),
BackgroundTransparency = 1,
Visible = false,
ClipsDescendants = true,
ZIndex = 51
})

local sectionCanvas = MakeScrollable(tabContent)

local tab = {
Name = name,
Button = tabBtn,
Content = tabContent,
SectionCanvas = sectionCanvas,
Sections = {}
}

tabBtn.MouseButton1Click:Connect(function()
self:SelectTab(name)
end)

[Link]:Connect(function()
Tween(tabBtn, {BackgroundColor3 = [Link]}, 0.25)
end)
[Link]:Connect(function()
if [Link] ~= tab then
Tween(tabBtn, {BackgroundColor3 = [Link]}, 0.25)
end
end)

[Link]([Link], tab)

if #[Link] == 1 then
self:SelectTab(name)
end

return tab
end

function Window:SelectTab(name)
for _, tab in ipairs([Link]) do
if [Link] == name then
[Link].BackgroundColor3 = [Link]
[Link].TextColor3 = [Link](1,1,1)
[Link] = true
[Link] = tab
else
[Link].BackgroundColor3 = [Link]
[Link].TextColor3 = [Link]
[Link] = false
end
end
end
local Section = {}
Section.__index = Section
setmetatable(Section, Widget)

function Section:AddToggle(text, callback)


local toggle = {}
[Link] = false

local container = Create("Frame", {


Parent = [Link],
Size = [Link](1, 0, 0, 30),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ZIndex = 52
})

local label = Create("TextLabel", {


Parent = container,
Text = text,
TextColor3 = [Link],
Font = [Link],
TextSize = 15,
BackgroundTransparency = 1,
Position = [Link](0, 6, 0, 5),
Size = [Link](1, -40, 1, 0),
TextXAlignment = [Link],
ZIndex = 53
})

local toggleBtn = Create("Frame", {


Parent = container,
Size = [Link](0, 36, 0, 20),
Position = [Link](1, -40, 0, 5),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ClipsDescendants = true,
ZIndex = 54
})
local corner = [Link]("UICorner", toggleBtn)
[Link] = [Link](0, 12)

local circle = Create("Frame", {


Parent = toggleBtn,
Size = [Link](0, 16, 0, 16),
Position = [Link](0, 2, 0, 2),
BackgroundColor3 = [Link](230,230,230),
BorderSizePixel = 0,
ZIndex = 55
})
local corner2 = [Link]("UICorner", circle)
[Link] = [Link](0, 8)

local function setState(state)


[Link] = state
if state then
Tween(toggleBtn, {BackgroundColor3 = [Link]}, 0.15)
Tween(circle, {Position = [Link](1, -18, 0, 2)}, 0.15)
else
Tween(toggleBtn, {BackgroundColor3 = [Link]}, 0.15)
Tween(circle, {Position = [Link](0, 2, 0, 2)}, 0.15)
end
if callback then
pcall(callback, state)
end
end

[Link]:Connect(function(input)
if [Link] == [Link].MouseButton1 or
[Link] == [Link] then
setState(not [Link])
end
end)

[Link] = container
[Link] = setState
[Link] = function() return [Link] end

setState(false)

return toggle
end

function Section:AddButton(text, callback)


local btn = {}

local container = Create("TextButton", {


Parent = [Link],
Text = text,
BackgroundColor3 = [Link],
TextColor3 = [Link],
Font = [Link],
TextSize = 15,
Size = [Link](1, 0, 0, 32),
BorderSizePixel = 0,
AutoButtonColor = false,
ZIndex = 52
})

-- Butona yuvarlak köşe


local btnCorner = [Link]("UICorner")
[Link] = [Link](0, 6)
[Link] = container

[Link]:Connect(function()
Tween(container, {BackgroundColor3 = [Link]}, 0.3)
end)
[Link]:Connect(function()
Tween(container, {BackgroundColor3 = [Link]}, 0.3)
end)

container.MouseButton1Click:Connect(function()
if callback then
pcall(callback)
end
end)
[Link] = container

return btn
end

function Section:AddSlider(text, min, max, default, callback)


local slider = {}
local dragging = false
local minVal = min or 0
local maxVal = max or 100
local value = default or minVal

local container = Create("Frame", {


Parent = [Link],
Size = [Link](1, 0, 0, 40),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ZIndex = 52
})

local label = Create("TextLabel", {


Parent = container,
Text = text .. ": " .. tostring(value),
TextColor3 = [Link],
Font = [Link],
TextSize = 14,
BackgroundTransparency = 1,
Position = [Link](0, 6, 0, 0),
Size = [Link](1, -12, 0, 20),
TextXAlignment = [Link],
ZIndex = 53
})

local sliderFrame = Create("Frame", {


Parent = container,
Size = [Link](1, -12, 0, 16),
Position = [Link](0, 6, 0, 24),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ClipsDescendants = true,
ZIndex = 54
})
local corner = [Link]("UICorner", sliderFrame)
[Link] = [Link](0, 8)

local fill = Create("Frame", {


Parent = sliderFrame,
Size = [Link]((value - minVal) / (maxVal - minVal), 0, 1, 0),
BackgroundColor3 = [Link],
BorderSizePixel = 0,
ZIndex = 55
})
local corner2 = [Link]("UICorner", fill)
[Link] = [Link](0, 8)

local function updateValueFromPos(x)


local relativeX = [Link](x - [Link].X, 0,
[Link].X)
local newValue = minVal + (relativeX / [Link].X) *
(maxVal - minVal)
value = [Link](newValue * 100) / 100
[Link] = [Link]((value - minVal) / (maxVal - minVal), 0, 1, 0)
[Link] = text .. ": " .. tostring(value)
if callback then
pcall(callback, value)
end
end

[Link]:Connect(function(input)
if [Link] == [Link].MouseButton1 or
[Link] == [Link] then
dragging = true
updateValueFromPos([Link].X)
end
end)

[Link]:Connect(function(input)
if dragging and ([Link] == [Link] or
[Link] == [Link]) then
updateValueFromPos([Link].X)
end
end)

[Link]:Connect(function(input)
if [Link] == [Link].MouseButton1 or
[Link] == [Link] then
dragging = false
end
end)

[Link] = container
[Link] = function() return value end
[Link] = function(newVal)
value = [Link](newVal, minVal, maxVal)
[Link] = [Link]((value - minVal) / (maxVal - minVal), 0, 1, 0)
[Link] = text .. ": " .. tostring(value)
end

return slider
end

function Section:AddDropdown(text, options, callback)


assert(type(options) == "table", "Options must be a table")
local dropdown = {}
local open = false
local selectedIndex = nil

local container = C

You might also like