local Library = {} -- Struktur dasar sesuai kode awal Anda -------------------------------------------------- -- SERVICES & VARIABLES -------------------------------------------------- local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local HttpService = game:GetService("HttpService") local Players = game:GetService("Players") local MarketplaceService = game:GetService("MarketplaceService") local LocalizationService = game:GetService("LocalizationService") local LocalPlayer = Players.LocalPlayer local GameName = MarketplaceService:GetProductInfo(game.PlaceId).Name local NameID = LocalPlayer.Name -------------------------------------------------- -- UTILITY FUNCTIONS -------------------------------------------------- local utility = {} function utility:Tween(instance, properties, duration, ...) TweenService:Create(instance, TweenInfo.new(duration, ...), properties):Play() end -- Fungsi untuk memulai animasi border RGB (efek dinamis) local function startDynamicBorder(uiElement) local hue = 0 spawn(function() while uiElement and uiElement.Parent do uiElement.BorderColor3 = Color3.fromHSV(hue, 1, 1) hue = (hue + 0.005) % 1 RunService.RenderStepped:Wait() end end) end -- Fungsi untuk membuat loading screen sederhana local function createLoadingScreen() local sg = Instance.new("ScreenGui") sg.Name = "LoadingScreen" sg.ResetOnSpawn = false sg.Parent = game.CoreGui local frame = Instance.new("Frame", sg) frame.Name = "LoadingFrame" frame.Size = UDim2.new(1, 0, 1, 0) frame.BackgroundColor3 = Color3.new(0, 0, 0) frame.BackgroundTransparency = 0.5 local spinner = Instance.new("ImageLabel", frame) spinner.Name = "Spinner" spinner.Size = UDim2.new(0, 100, 0, 100) spinner.AnchorPoint = Vector2.new(0.5, 0.5) spinner.Position = UDim2.new(0.5, 0, 0.5, 0) spinner.Image = "rbxassetid://6034818372" -- Ganti dengan asset spinner pilihan Anda spinner.BackgroundTransparency = 1 delay(2, function() utility:Tween(frame, {BackgroundTransparency = 1}, 1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) wait(1) sg:Destroy() end) end -------------------------------- -- UKURAN UI (MODE) -------------------------------- local sizes = { small = {width = 400, height = 300}, medium = {width = 600, height = 450}, large = {width = 800, height = 600}, } -------------------------------------------------- -- SAVE/LOAD CONFIG & NOTIFICATION FUNCTIONS -------------------------------------------------- -- Jika fungsi writefile/readfile tidak tersedia, abaikan blok ini. local SettingToggle = {} local ConfigFileName = "BTConfig.JSON" if writefile and readfile then pcall(function() if not pcall(function() readfile(ConfigFileName) end) then writefile(ConfigFileName, HttpService:JSONEncode(SettingToggle)) end -- Hanya menyimpan string config ke variabel Settings sebagai contoh. Settings = HttpService:JSONEncode(readfile(ConfigFileName)) end) else warn("Fungsi file I/O tidak tersedia. Fitur SaveConfig/LoadConfig dinonaktifkan.") Settings = "" end function Library:SaveConfig(configTable, fileName) if writefile and readfile then local success, encoded = pcall(function() return HttpService:JSONEncode(configTable) end) if success then local ws, err = pcall(function() writefile(fileName, encoded) end) if ws then return true else warn("Failed to write config file:", err) return false end else warn("Failed to encode config:", encoded) return false end else warn("SaveConfig tidak tersedia karena file I/O tidak didukung.") return false end end function Library:LoadConfig(fileName) if writefile and readfile then local success, content = pcall(function() return readfile(fileName) end) if success and content then local ok, decoded = pcall(function() return HttpService:JSONDecode(content) end) if ok then return decoded else warn("Failed to decode config:", decoded) end else warn("Failed to read config file:", content) end return nil else warn("LoadConfig tidak tersedia karena file I/O tidak didukung.") return nil end end function Library:MakeNotification(options) local sg = Instance.new("ScreenGui") sg.Name = "Notification" sg.ResetOnSpawn = false sg.Parent = game.CoreGui local frame = Instance.new("Frame", sg) frame.Size = UDim2.new(0, 300, 0, 100) frame.Position = UDim2.new(0.5, -150, 0.8, 0) frame.BackgroundColor3 = Color3.fromRGB(20,20,20) frame.BackgroundTransparency = 0.3 frame.BorderSizePixel = 0 local titleLabel = Instance.new("TextLabel", frame) titleLabel.Size = UDim2.new(1,0,0,30) titleLabel.Text = options.Name or "Notification" titleLabel.Font = Enum.Font.SourceSansBold titleLabel.TextSize = 20 titleLabel.TextColor3 = Color3.new(1,1,1) titleLabel.BackgroundTransparency = 1 local contentLabel = Instance.new("TextLabel", frame) contentLabel.Position = UDim2.new(0,0,0,30) contentLabel.Size = UDim2.new(1,0,0,70) contentLabel.Text = options.Content or "" contentLabel.Font = Enum.Font.SourceSans contentLabel.TextSize = 14 contentLabel.TextColor3 = Color3.new(1,1,1) contentLabel.BackgroundTransparency = 1 delay(options.Time or 5, function() sg:Destroy() end) end -------------------------------------------------- -- PEMBUATAN WINDOW, TAB, & SECTION -------------------------------------------------- -- Fungsi MakeWindow(options): Membuat window utama. function Library:MakeWindow(options) options = options or {} local windowTitle = options.Name or "UI Library" createLoadingScreen() local sg = Instance.new("ScreenGui") sg.Name = LibName sg.Parent = game.CoreGui sg.ZIndexBehavior = Enum.ZIndexBehavior.Global local Body = Instance.new("Frame", sg) Body.Name = "Body" Body.BackgroundColor3 = Color3.fromRGB(12,12,12) Body.BorderColor3 = Color3.fromRGB(0,0,0) Body.BorderSizePixel = 0 Body.Position = UDim2.new(0.258, 0, 0.218, 0) Body.Size = UDim2.new(0, 600, 0, 350) -- Ukuran default ("small") Body.ClipsDescendants = true local Body_Corner = Instance.new("UICorner") Body_Corner.CornerRadius = UDim.new(0, 5) Body_Corner.Parent = Body local Title_Hub = Instance.new("TextLabel", Body) Title_Hub.Name = "Title_Hub" Title_Hub.BackgroundTransparency = 1 Title_Hub.Position = UDim2.new(0, 5, 0, 0) Title_Hub.Size = UDim2.new(0, 558, 0, 30) Title_Hub.Font = Enum.Font.SourceSansBold Title_Hub.Text = windowTitle .. " - " .. GameName Title_Hub.TextColor3 = Color3.fromRGB(255,255,255) Title_Hub.TextSize = 15 Title_Hub.TextXAlignment = Enum.TextXAlignment.Left -- Tombol minimize local MInimize_Button = Instance.new("TextButton", Body) MInimize_Button.Name = "MInimize_Button" MInimize_Button.BackgroundTransparency = 1 MInimize_Button.Position = UDim2.new(0, 570, 0, 0) MInimize_Button.Rotation = -315 MInimize_Button.Size = UDim2.new(0, 30, 0, 30) MInimize_Button.AutoButtonColor = false MInimize_Button.Font = Enum.Font.SourceSans MInimize_Button.Text = "+" MInimize_Button.TextColor3 = Color3.fromRGB(255,255,255) MInimize_Button.TextSize = 40 MInimize_Button.MouseButton1Click:Connect(function() if Body.Visible then utility:Tween(Body, {Size = UDim2.new(0, 600, 0, 32)}, 0.3) utility:Tween(MInimize_Button, {Rotation = 360}, 0.3) Body.Visible = false else utility:Tween(Body, {Size = UDim2.new(0, 600, 0, 350)}, 0.3) utility:Tween(MInimize_Button, {Rotation = -315}, 0.3) Body.Visible = true end end) startDynamicBorder(Body) -- Container untuk tombol tab (bagian atas Body) local TabButtons = Instance.new("Frame", Body) TabButtons.Name = "TabButtons" TabButtons.Size = UDim2.new(1, 0, 0, 30) TabButtons.Position = UDim2.new(0, 0, 0, 30) TabButtons.BackgroundTransparency = 1 local btnLayout = Instance.new("UIListLayout", TabButtons) btnLayout.FillDirection = Enum.FillDirection.Horizontal btnLayout.HorizontalAlignment = Enum.HorizontalAlignment.Left btnLayout.SortOrder = Enum.SortOrder.LayoutOrder btnLayout.Padding = UDim.new(0, 5) -- Container untuk konten tab local TabContent = Instance.new("Frame", Body) TabContent.Name = "TabContent" TabContent.Size = UDim2.new(1, 0, 1, -60) TabContent.Position = UDim2.new(0, 0, 0, 60) TabContent.BackgroundTransparency = 1 local WindowObject = {} function WindowObject:SetUISize(mode) local s = sizes[mode] if s then tween(Body, {Size = UDim2.new(0, s.width, 0, s.height)}, 0.3) else warn("Invalid size mode. Use 'small', 'medium', or 'large'.") end end function WindowObject:MakeTab(options) options = options or {} local tabName = options.Name or "Tab" local tabButton = Instance.new("TextButton", TabButtons) tabButton.Name = "TabButton_" .. tabName tabButton.Size = UDim2.new(0, 100, 0, 30) tabButton.BackgroundColor3 = Color3.fromRGB(50,50,50) tabButton.Text = tabName tabButton.Font = Enum.Font.SourceSans tabButton.TextSize = 16 tabButton.TextColor3 = Color3.new(1,1,1) local contentFrame = Instance.new("Frame", TabContent) contentFrame.Name = "TabContent_" .. tabName contentFrame.Size = UDim2.new(1, 0, 1, 0) contentFrame.Position = UDim2.new(0, 0, 0, 0) contentFrame.BackgroundTransparency = 1 contentFrame.Visible = false tabButton.MouseButton1Click:Connect(function() for _, v in ipairs(TabContent:GetChildren()) do if v:IsA("Frame") then v.Visible = false end end contentFrame.Visible = true end) local TabObject = {} function TabObject:AddSection(options) options = options or {} local sectionName = options.Name or "Section" local sectionFrame = Instance.new("Frame", contentFrame) sectionFrame.Name = "Section_" .. sectionName sectionFrame.Size = UDim2.new(1, -10, 0, 150) sectionFrame.Position = UDim2.new(0, 5, 0, 5) sectionFrame.BackgroundColor3 = Color3.fromRGB(30,30,30) sectionFrame.BorderSizePixel = 0 local sectionHeader = Instance.new("TextLabel", sectionFrame) sectionHeader.Name = "SectionHeader" sectionHeader.Size = UDim2.new(1, 0, 0, 25) sectionHeader.BackgroundTransparency = 1 sectionHeader.Text = sectionName sectionHeader.Font = Enum.Font.SourceSansBold sectionHeader.TextSize = 18 sectionHeader.TextColor3 = Color3.new(1,1,1) sectionHeader.TextXAlignment = Enum.TextXAlignment.Left local elementContainer = Instance.new("Frame", sectionFrame) elementContainer.Name = "ElementContainer" elementContainer.Size = UDim2.new(1, 0, 1, -25) elementContainer.Position = UDim2.new(0, 0, 0, 25) elementContainer.BackgroundTransparency = 1 local layout = Instance.new("UIListLayout", elementContainer) layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Padding = UDim.new(0, 5) local SectionObject = {} function SectionObject:addButton(title, callback) callback = callback or function() end local btn = Instance.new("TextButton", elementContainer) btn.Size = UDim2.new(1, -10, 0, 30) btn.BackgroundColor3 = Color3.fromRGB(50,50,50) btn.Text = title btn.Font = Enum.Font.SourceSans btn.TextSize = 16 btn.TextColor3 = Color3.new(1,1,1) btn.MouseButton1Click:Connect(callback) end function SectionObject:addToggle(title, default, callback) callback = callback or function() end local toggleFrame = Instance.new("Frame", elementContainer) toggleFrame.Size = UDim2.new(1, -10, 0, 30) toggleFrame.BackgroundColor3 = Color3.fromRGB(50,50,50) local label = Instance.new("TextLabel", toggleFrame) label.Size = UDim2.new(0.7, 0, 1, 0) label.BackgroundTransparency = 1 label.Text = title label.Font = Enum.Font.SourceSans label.TextSize = 16 label.TextColor3 = Color3.new(1,1,1) label.TextXAlignment = Enum.TextXAlignment.Left local toggleButton = Instance.new("TextButton", toggleFrame) toggleButton.Size = UDim2.new(0.3, 0, 1, 0) toggleButton.Position = UDim2.new(0.7, 0, 0, 0) toggleButton.BackgroundColor3 = default and Color3.fromRGB(0,255,0) or Color3.fromRGB(255,0,0) toggleButton.Text = default and "ON" or "OFF" toggleButton.Font = Enum.Font.SourceSansBold toggleButton.TextSize = 16 toggleButton.TextColor3 = Color3.new(1,1,1) toggleButton.MouseButton1Click:Connect(function() default = not default toggleButton.BackgroundColor3 = default and Color3.fromRGB(0,255,0) or Color3.fromRGB(255,0,0) toggleButton.Text = default and "ON" or "OFF" callback(default) end) end function SectionObject:addDropdown(title, default, list, callback) callback = callback or function() end local dropdownFrame = Instance.new("Frame", elementContainer) dropdownFrame.Size = UDim2.new(1, -10, 0, 30) dropdownFrame.BackgroundColor3 = Color3.fromRGB(50,50,50) local label = Instance.new("TextLabel", dropdownFrame) label.Size = UDim2.new(0.7, 0, 1, 0) label.BackgroundTransparency = 1 label.Text = title .. " : " .. default label.Font = Enum.Font.SourceSans label.TextSize = 16 label.TextColor3 = Color3.new(1,1,1) label.TextXAlignment = Enum.TextXAlignment.Left local dropdownButton = Instance.new("TextButton", dropdownFrame) dropdownButton.Size = UDim2.new(0.3, 0, 1, 0) dropdownButton.Position = UDim2.new(0.7, 0, 0, 0) dropdownButton.BackgroundColor3 = Color3.fromRGB(70,70,70) dropdownButton.Text = "v" dropdownButton.Font = Enum.Font.SourceSansBold dropdownButton.TextSize = 16 dropdownButton.TextColor3 = Color3.new(1,1,1) local optionsContainer = Instance.new("Frame", dropdownFrame) optionsContainer.Size = UDim2.new(1, 0, 0, #list * 30) optionsContainer.Position = UDim2.new(0, 0, 1, 0) optionsContainer.BackgroundColor3 = Color3.fromRGB(50,50,50) optionsContainer.Visible = false local optionsLayout = Instance.new("UIListLayout", optionsContainer) optionsLayout.SortOrder = Enum.SortOrder.LayoutOrder optionsLayout.Padding = UDim.new(0, 2) for _, option in ipairs(list) do local optionBtn = Instance.new("TextButton", optionsContainer) optionBtn.Size = UDim2.new(1, 0, 0, 30) optionBtn.BackgroundColor3 = Color3.fromRGB(60,60,60) optionBtn.Text = option optionBtn.Font = Enum.Font.SourceSans optionBtn.TextSize = 16 optionBtn.TextColor3 = Color3.new(1,1,1) optionBtn.MouseButton1Click:Connect(function() label.Text = title .. " : " .. option optionsContainer.Visible = false callback(option) end) end dropdownButton.MouseButton1Click:Connect(function() optionsContainer.Visible = not optionsContainer.Visible end) end function SectionObject:addSlider(title, min, max, default, callback) callback = callback or function() end local sliderFrame = Instance.new("Frame", elementContainer) sliderFrame.Size = UDim2.new(1, -10, 0, 40) sliderFrame.BackgroundColor3 = Color3.fromRGB(50,50,50) local label = Instance.new("TextLabel", sliderFrame) label.Size = UDim2.new(0, 150, 1, 0) label.BackgroundTransparency = 1 label.Text = title .. " : " .. tostring(default) label.Font = Enum.Font.SourceSans label.TextSize = 16 label.TextColor3 = Color3.new(1,1,1) label.TextXAlignment = Enum.TextXAlignment.Left local sliderTrack = Instance.new("Frame", sliderFrame) sliderTrack.Size = UDim2.new(1, -160, 0, 10) sliderTrack.Position = UDim2.new(0, 160, 0.5, -5) sliderTrack.BackgroundColor3 = Color3.fromRGB(80,80,80) local sliderKnob = Instance.new("Frame", sliderTrack) sliderKnob.Size = UDim2.new(0, 10, 1, 0) local knobX = (default - min) / (max - min) sliderKnob.Position = UDim2.new(knobX, -5, 0, 0) sliderKnob.BackgroundColor3 = Color3.fromRGB(255,0,0) local dragging = false sliderKnob.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true end end) sliderKnob.InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then local relX = math.clamp(input.Position.X - sliderTrack.AbsolutePosition.X, 0, sliderTrack.AbsoluteSize.X) local newVal = min + ((max - min) * (relX / sliderTrack.AbsoluteSize.X)) sliderKnob.Position = UDim2.new(relX / sliderTrack.AbsoluteSize.X, -5, 0, 0) label.Text = title .. " : " .. string.format("%.2f", newVal) callback(newVal) end end) sliderKnob.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) end function SectionObject:addKeybind(title, preset, callback) callback = callback or function() end local keybindFrame = Instance.new("Frame", elementContainer) keybindFrame.Size = UDim2.new(1, -10, 0, 30) keybindFrame.BackgroundColor3 = Color3.fromRGB(50,50,50) local label = Instance.new("TextLabel", keybindFrame) label.Size = UDim2.new(0, 150, 1, 0) label.BackgroundTransparency = 1 label.Text = title label.Font = Enum.Font.SourceSans label.TextSize = 16 label.TextColor3 = Color3.new(1,1,1) label.TextXAlignment = Enum.TextXAlignment.Left local bindButton = Instance.new("TextButton", keybindFrame) bindButton.Size = UDim2.new(0, 100, 1, 0) bindButton.Position = UDim2.new(0, 160, 0, 0) bindButton.BackgroundColor3 = Color3.fromRGB(70,70,70) bindButton.Text = preset.Name bindButton.Font = Enum.Font.SourceSansBold bindButton.TextSize = 16 bindButton.TextColor3 = Color3.new(1,1,1) bindButton.MouseButton1Click:Connect(function() bindButton.Text = "..." local input = UserInputService.InputBegan:Wait() if input and input.KeyCode then bindButton.Text = input.KeyCode.Name callback(input.KeyCode.Name) end end) end function SectionObject:addLabel(text) local lbl = Instance.new("TextLabel", elementContainer) lbl.Size = UDim2.new(1, -10, 0, 20) lbl.BackgroundTransparency = 1 lbl.Text = text lbl.Font = Enum.Font.SourceSans lbl.TextSize = 16 lbl.TextColor3 = Color3.new(1,1,1) lbl.TextXAlignment = Enum.TextXAlignment.Left end function SectionObject:addChangelog(text) local lbl = Instance.new("TextLabel", elementContainer) lbl.Size = UDim2.new(1, -10, 0, 20) lbl.BackgroundTransparency = 1 lbl.Text = text lbl.Font = Enum.Font.SourceSans lbl.TextSize = 16 lbl.TextColor3 = Color3.fromRGB(85,170,255) lbl.TextXAlignment = Enum.TextXAlignment.Left end function SectionObject:addLog(text) local lbl = Instance.new("TextLabel", elementContainer) lbl.Size = UDim2.new(1, -10, 0, 20) lbl.BackgroundTransparency = 1 lbl.Text = text lbl.Font = Enum.Font.SourceSans lbl.TextSize = 16 lbl.TextColor3 = Color3.fromRGB(255,255,0) lbl.TextXAlignment = Enum.TextXAlignment.Left end return SectionObject end return TabObject end function Library:MakeTab(options) error("MakeTab harus dipanggil dari objek window. Gunakan Window:MakeTab(options).") end function Library:AddSection(options) error("AddSection harus dipanggil dari objek tab. Gunakan Tab:AddSection(options).") end function WindowObject:MakeNotification(options) Library:MakeNotification(options) end return WindowObject end -------------------------------------------------- -- RETURN LIBRARY -------------------------------------------------- return Library