Skip to content
RoRoScripts
TopBarPlus Library preview
UnknownUniversal

TopBarPlus Library

Script
Views
128
Likes
1
Dislikes
0
Added
Script
local Library = "https://raw.githubusercontent.com/MemberLol/TopBarPlus/refs/heads/main/Library"

local genv = (getgenv and getgenv()) or _G
genv.TopbarPlusLibrary = nil

local source = game:HttpGet(Library)
local Icon = loadstring(source)()

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")

local image = 6034287594
local demo = {}

local function say(text)
    pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = "TopbarPlus Demo",
            Text = text,
            Duration = 2,
        })
    end)
end

local function make()
    local icon = Icon.new()
    table.insert(demo, icon)
    return icon
end

local gui = Instance.new("ScreenGui")
gui.Name = "TopbarPlusDemoPanel"
gui.ResetOnSpawn = false
gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")

local panel = Instance.new("Frame")
panel.Size = UDim2.fromOffset(240, 120)
panel.Position = UDim2.new(0.5, -120, 0.5, -60)
panel.BackgroundColor3 = Color3.fromRGB(18, 18, 21)
panel.Visible = false
panel.Parent = gui

local panelCorner = Instance.new("UICorner")
panelCorner.CornerRadius = UDim.new(0, 12)
panelCorner.Parent = panel

local panelText = Instance.new("TextLabel")
panelText.Size = UDim2.fromScale(1, 1)
panelText.BackgroundTransparency = 1
panelText.Text = "Demo Panel"
panelText.TextColor3 = Color3.fromRGB(255, 255, 255)
panelText.TextSize = 20
panelText.Font = Enum.Font.GothamBold
panelText.Parent = panel

make()
    :setName("DemoImage")
    :setImage(image)
    :setCaption("Image button")
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Image button clicked")
    end)

make()
    :setName("DemoText")
    :setLabel("Text")
    :setCaption("Text button")
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Text button clicked")
    end)

make()
    :setName("DemoImageText")
    :setImage(image)
    :setLabel("Both")
    :setCaption("Image and text")
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Image and text clicked")
    end)

local toggle = make()
    :setName("DemoToggle")
    :setLabel("Toggle")
    :setCaption("Stays on until clicked again")
    :setLeft()

toggle.selected:Connect(function()
    say("Toggle ON")
end)
toggle.deselected:Connect(function()
    say("Toggle OFF")
end)

make()
    :setName("DemoHotkey")
    :setLabel("Hotkey")
    :setCaption("Press G")
    :bindToggleKey(Enum.KeyCode.G)
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Hotkey button triggered")
    end)

local notice = make()
    :setName("DemoNotice")
    :setLabel("Notice")
    :setCaption("Clears when clicked")
    :setLeft()
notice:notify()
notice:notify()
notice:notify()

make()
    :setName("DemoColored")
    :setLabel("Red")
    :setCaption("Custom colors")
    :modifyTheme({
        { "IconButton", "BackgroundColor3", Color3.fromRGB(200, 40, 40) },
        { "IconButton", "BackgroundTransparency", 0 },
        { "IconLabel", "TextColor3", Color3.fromRGB(255, 255, 255) },
    })
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Red button clicked")
    end)

make()
    :setName("DemoWide")
    :setLabel("Wide and square")
    :setCaption("Custom width and corners")
    :setWidth(150)
    :setCornerRadius(UDim.new(0, 8))
    :oneClick()
    :setLeft()
    .selected:Connect(function()
        say("Wide button clicked")
    end)

make()
    :setName("DemoLocked")
    :setLabel("Locked")
    :setCaption("Cannot be clicked")
    :lock()
    :setLeft()

make()
    :setName("DemoPanel")
    :setLabel("Panel")
    :setCaption("Shows and hides a window")
    :bindToggleItem(panel)
    :setLeft()

make()
    :setName("DemoMid")
    :setLabel("Center")
    :setCaption("Centered button")
    :oneClick()
    :setMid()
    .selected:Connect(function()
        say("Center button clicked")
    end)

local option1 = make():setLabel("Option 1"):oneClick()
local option2 = make():setLabel("Option 2"):oneClick()
local option3 = make():setLabel("Option 3"):oneClick()

option1.selected:Connect(function()
    say("Dropdown: Option 1")
end)
option2.selected:Connect(function()
    say("Dropdown: Option 2")
end)
option3.selected:Connect(function()
    say("Dropdown: Option 3")
end)

make()
    :setName("DemoDropdown")
    :setLabel("Dropdown")
    :setCaption("Opens a list")
    :setDropdown({ option1, option2, option3 })
    :setRight()

local itemA = make():setLabel("A"):oneClick()
local itemB = make():setLabel("B"):oneClick()
local itemC = make():setLabel("C"):oneClick()

itemA.selected:Connect(function()
    say("Menu: A")
end)
itemB.selected:Connect(function()
    say("Menu: B")
end)
itemC.selected:Connect(function()
    say("Menu: C")
end)

make()
    :setName("DemoMenu")
    :setLabel("Menu")
    :setCaption("Expands sideways")
    :setMenu({ itemA, itemB, itemC })
    :setRight()

local cleanup = make()
    :setName("DemoRemove")
    :setLabel("Remove demo")
    :setCaption("Deletes every demo button")
    :oneClick()
    :setRight()

local cleaningUp = false

cleanup.selected:Connect(function()
    if cleaningUp then
        return
    end
    cleaningUp = true

    local copy = table.clone(demo)
    if gui.Parent then
        gui:Destroy()
    end
    task.defer(function()
        for i = #copy, 1, -1 do
            pcall(function()
                copy[i]:destroy()
            end)
        end
    end)
end)
TopBarPlus Library · RoScripts