local PochangUI = {} print("enjoy!") -- Services local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Player = Players.LocalPlayer -- Load GUI local gui if RunService:IsStudio() then gui = ReplicatedStorage:WaitForChild("RobloxPanelApp"):Clone() gui.Parent = Player:WaitForChild("PlayerGui") else gui = game:GetObjects("rbxassetid://83748361362401")[1] gui.Parent = game:GetService("CoreGui") end local disabled = false local tabs = 0 -- Tab template local tabTemplate = { Index = 0, Name = "template", Elements = {}, ElementsCount = 0, FrameInstance = nil, } -- CreateLabel method function tabTemplate:CreateLabel(text: string) if text ~= nil then self.ElementsCount += 1 local templatesFolder = gui:FindFirstChild("templates") local labelTemplate = templatesFolder and templatesFolder:FindFirstChild("Label") if not labelTemplate then warn("Missing 'Label' TextLabel inside templates folder") return nil end local labelgui = labelTemplate:Clone() labelgui.Text = text labelgui.Name = "Label_" .. tostring(self.ElementsCount) labelgui.Visible = true if not self.FrameInstance then warn("FrameInstance is nil for tab '" .. self.Name .. "' — call CreateLabel on a tab returned by CreateTab") return nil end labelgui.Parent = self.FrameInstance table.insert(self.Elements, labelgui) print("Label created:", labelgui.Name, "Parent:", labelgui.Parent.Name) return labelgui end end function tabTemplate:CreateButton(text: string, callback: ()->()) if text ~= nil then self.ElementsCount += 1 local templatesFolder = gui:FindFirstChild("templates") local buttonTemplate = templatesFolder and templatesFolder:FindFirstChild("Button") if not buttonTemplate then warn("Missing 'Button' TextButton inside templates folder") return nil end local buttongui = buttonTemplate:Clone() buttongui.Text = text buttongui.Name = "Button_" .. tostring(self.ElementsCount) buttongui.Visible = true if not self.FrameInstance then warn("FrameInstance is nil for tab '" .. self.Name .. "' — call CreateButton on a tab returned by CreateTab") return nil end -- Use MouseButton1Click for PC clicks buttongui.MouseButton1Click:Connect(function() if callback then callback() end end) buttongui.Parent = self.FrameInstance table.insert(self.Elements, buttongui) print("Button created:", buttongui.Name, "Parent:", buttongui.Parent.Name) return buttongui end end function tabTemplate:CreateInput(placeholder: string, callback: (string)->()) self.ElementsCount += 1 local templatesFolder = gui:FindFirstChild("templates") local inputTemplate = templatesFolder and templatesFolder:FindFirstChild("Input") if not inputTemplate then warn("Missing 'Input' TextBox inside templates folder") return nil end local inputgui = inputTemplate:Clone() inputgui.PlaceholderText = placeholder or "Enter text..." inputgui.Name = "Input_" .. tostring(self.ElementsCount) inputgui.Visible = true if not self.FrameInstance then warn("FrameInstance is nil for tab '" .. self.Name .. "' — call CreateInput on a tab returned by CreateTab") return nil end -- Fire callback whenever text changes inputgui:GetPropertyChangedSignal("Text"):Connect(function() if callback then callback(inputgui.Text) end end) -- Optional: fire callback when user presses Enter inputgui.FocusLost:Connect(function(enterPressed) if enterPressed and callback then callback(inputgui.Text) end end) inputgui.Parent = self.FrameInstance table.insert(self.Elements, inputgui) print("Input created:", inputgui.Name, "Parent:", inputgui.Parent.Name) return inputgui end -- Window controls (original style but safe) function PochangUI:SetTitle(title: string) if not disabled then if gui.Window and gui.Window:FindFirstChild("Topbar") and gui.Window.Topbar:FindFirstChild("Title") then gui.Window.Topbar.Title.Text = tostring(title) end if gui:FindFirstChild("WindowAnim") and gui.WindowAnim:FindFirstChild("Topbar") and gui.WindowAnim.Topbar:FindFirstChild("Title") then gui.WindowAnim.Topbar.Title.Text = tostring(title) end end end -- Remove function PochangUI:Remove() disabled = true if gui then gui:Destroy() end end -- CreateTab method function PochangUI:CreateTab(title: string) local tabt = table.clone(tabTemplate) tabs += 1 tabt.Index = tabs if typeof(title) ~= "string" then warn("Title must be a string") return tabt end tabt.Name = title local tabgui = gui.Window.TabList.Template:Clone() tabgui.Name = tostring(tabt.Index) tabgui.Visible = true tabgui.Text = tabt.Name tabgui.Parent = gui.Window.TabList if tabs == 1 then --auto select tab (appearance) tabgui.BackgroundColor3 = Color3.fromRGB(255,255,255) else tabgui.BackgroundColor3 = Color3.fromRGB(128,128,128) end local frame = gui.Window.Displayed.Template:Clone() frame.Name = tostring(tabt.Index) frame.Visible = (tabt.Index == 1) frame.Parent = gui.Window.Displayed tabt.FrameInstance = frame local layout = Instance.new("UIListLayout") layout.Parent = frame layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Padding = UDim.new(0,8) local function updateScroll() local children = frame:GetChildren() local elementCount = 0 for i in children do if children[i]:IsA("GuiObject") then elementCount += 1 end end local scrollHeight = (elementCount * 50) local scrollPad = (elementCount - 1 * 8) local scrollHP = scrollHeight + scrollPad frame.CanvasSize = UDim2.new(0,0,0,scrollHP) end frame.ChildAdded:Connect(updateScroll) frame.ChildRemoved:Connect(updateScroll) if tabgui.Activated then tabgui.Activated:Connect(function() for _, child in ipairs(gui.Window.Displayed:GetChildren()) do if child:IsA("GuiObject") then child.Visible = false end end for _, child in ipairs(gui.Window.TabList:GetChildren()) do if child:IsA("GuiObject") then child.BackgroundColor3 = Color3.fromRGB(128,128,128) end end tabt.FrameInstance.Visible = true tabgui.BackgroundColor3 = Color3.fromRGB(255,255,255) end) else warn("Tab button does not support Activated event") end setmetatable(tabt, { __index = function(self, key) if key == "Name" then tabgui.Text = tabt.Name end end }) return tabt end return PochangUI