-- Services
local Players = game:GetService("Players")
-- Player
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = playerGui
screenGui.Name = "MyGUI"
-- Create Collapsible Frame
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) -- Ronin-style dark background color
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true -- Make the frame draggable
mainFrame.Parent = screenGui
local collapsed = false
-- Create Collapse/Expand Button
local collapseButton = Instance.new("TextButton")
collapseButton.Size = UDim2.new(0, 30, 0, 30)
collapseButton.Position = UDim2.new(1, -30, 0, 0)
collapseButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) -- Collapse button color
collapseButton.Text = "^"
collapseButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text color
collapseButton.Parent = mainFrame
-- Function to toggle between collapsed and expanded states
local function toggleCollapse()
collapsed = not collapsed
if collapsed then
mainFrame:TweenSize(UDim2.new(0, 400, 0, 30), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
collapseButton.Text = "v"
else
mainFrame:TweenSize(UDim2.new(0, 400, 0, 300), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
collapseButton.Text = "^"
end
end
-- Connect the toggleCollapse function to run when the collapse button is clicked
collapseButton.MouseButton1Click:Connect(toggleCollapse)
-- Create Tabbed Layout
local tabContainer = Instance.new("Frame")
tabContainer.Size = UDim2.new(1, 0, 0, 30)
tabContainer.Position = UDim2.new(0, 0, 0, 0)
tabContainer.BackgroundColor3 = Color3.fromRGB(50, 50, 50) -- Tab container color
tabContainer.Parent = mainFrame
local tabs = {
{Name = "Tab 1", Icon = "rbxassetid://123456789"}, -- Replace with actual icon asset ID
{Name = "Tab 2", Icon = "rbxassetid://987654321"}, -- Replace with actual icon asset ID
{Name = "Tab 3", Icon = "rbxassetid://111222333"} -- Replace with actual icon asset ID
}
local currentPage = 1
-- Create Tabs
for i, tabData in ipairs(tabs) do
local tabButton = Instance.new("TextButton")
tabButton.Size = UDim2.new(0, 100, 1, 0)
tabButton.Position = UDim2.new(0, (i - 1) * 100, 0, 0)
tabButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60) -- Tab button color
tabButton.Text = ""
tabButton.Parent = tabContainer
-- Create tab icon
local icon = Instance.new("ImageLabel")
icon.Size = UDim2.new(0.6, 0, 0.6, 0)
icon.Position = UDim2.new(0.2, 0, 0.2, 0)
icon.BackgroundTransparency = 1
icon.Image = tabData.Icon
icon.Parent = tabButton
-- Switch to the corresponding tab when a button is clicked
tabButton.MouseButton1Click:Connect(function()
if i ~= currentPage then
currentPage = i
updateContent()
end
end)
end
-- Function to update GUI content based on the selected tab
local function updateContent()
print("Updating content for Tab " .. currentPage)
-- Add logic to update GUI content based on the selected tab
-- Clear existing content
for _, existingContent in ipairs(mainFrame:GetChildren()) do
if existingContent:IsA("Frame") and existingContent.Name ~= "TabContainer" then
existingContent:Destroy()
end
end
-- Create dynamic content based on the selected tab
local contentFrame = Instance.new("Frame")
contentFrame.Size = UDim2.new(1, 0, 1, -30)
contentFrame.Position = UDim2.new(0, 0, 0, 30)
contentFrame.Parent = mainFrame
if currentPage == 1 then
-- Add content for Tab 1
-- Example: Create a button in Tab 1
local buttonInTab1 = Instance.new("TextButton")
buttonInTab1.Size = UDim2.new(0, 150, 0, 50)
buttonInTab1.Position = UDim2.new(0.5, -75, 0.5, -25)
buttonInTab1.BackgroundColor3 = Color3.fromRGB(70, 70, 70) -- Content color
buttonInTab1.Text = "Button in Tab 1"
buttonInTab1.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text color
buttonInTab1.Parent = contentFrame
-- Connect a function to execute when the button is clicked
buttonInTab1.MouseButton1Click:Connect(function()
print("Button in Tab 1 clicked!")
end)
elseif currentPage == 2 then
-- Add content for Tab 2
-- Example: Create a textbox in Tab 2
local textboxInTab2 = Instance.new("TextBox")
textboxInTab2.Size = UDim2.new(0, 200, 0, 30)
textboxInTab2.Position = UDim2.new(0.5, -100, 0.5, -15)
textboxInTab2.BackgroundColor3 = Color3.fromRGB(70, 70, 70) -- Content color
textboxInTab2.Text = "Text in Tab 2"
textboxInTab2.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text color
textboxInTab2.Parent = contentFrame
elseif currentPage == 3 then
-- Add content for Tab 3
-- Example: Create an image in Tab 3
local imageInTab3 = Instance.new("ImageLabel")
imageInTab3.Size = UDim2.new(0, 150, 0, 150)
imageInTab3.Position = UDim2.new(0.5, -75, 0.5, -75)
imageInTab3.BackgroundColor3 = Color3.fromRGB(70, 70, 70) -- Content color
imageInTab3.Image = tabData.Icon -- Replace with the actual image asset ID
imageInTab3.Parent = contentFrame
end
end
-- Connect the updateContent function to run when the player changes the current tab
playerGui.MyGUI.MainFrame:GetPropertyChangedSignal("Position"):Connect(updateContent)
-- Initial content update
updateContent()