Roblox DockWidget Plugin Template (Open Source)

sideMenuWidget Plugin Intro:
For everyone who wants to make a plugin involving a “sideMenuWidget” and doesn’t want to type the Setup every single time, this template is for you.

What is the use:
This template (After saving as a local plugin.) lets you create a sideMenuWidget Menu to function as a template for adding buttons and GUIs.

How to use:
You paste this code into your Server-Storage folder then right-click it (click “Save as Local Plugin” to test or click “Publish as Plugin” to publish), you go to your toolbar and find the “PLUGINS” tab, and you should see your custom plugin saved, click it to see the effect.

Template-Code:

local ChangeHistoryService = game:GetService("ChangeHistoryService");
local Selection = game:GetService("Selection");

-- Create a new toolbar section titled "Widget-Menu"
local toolbar = plugin:CreateToolbar("Widget-Menu");

-- Add a toolbar button named "Widget Menu Display Plugin" ("Name" - "Description" - "Icon-ID")
local newScriptButton = toolbar:CreateButton("Widget Menu Display Plugin", "Creates a Widget Menu", "rbxassetid://4458901886");

-- Make button clickable even if 3D viewport is hidden
newScriptButton.ClickableWhenViewportHidden = true;

local sideMenuWidget = plugin:CreateDockWidgetPluginGui("Widget-SideBar", DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Right,  -- Set the initial dock state to the right side
	false,  -- Set whether the widget can be resized
	false,  -- Set whether the widget can be closed by the user
	200,    -- Set the width of the widget
	300,    -- Set the height of the widget
	150,    -- Set the minimum width of the widget
	150     -- Set the minimum height of the widget
	))

local function onOpenSideMenu()
	-- Close the side menu if it's already open
	sideMenuWidget.Enabled = not sideMenuWidget.Enabled;

end

-- Customize the side menu widget UI
-- Add your own GUI objects and functionality here

-- Set the widget title
sideMenuWidget.Title = "Widget-SideBar";

-- Display the Menu
sideMenuWidget.Enabled = false;

-- Calling the function
newScriptButton.Click:Connect(onOpenSideMenu);

Tutorial:
(If you don’t understand how to make a plugin, here is a tutorial): https://www.youtube.com/watch?v=Rou1Wt9NOww

:hearts: If this template helped you consider leaving a like. :hearts:
:red_square: For any bug reports join the Roblox group: B.Rover Studio - Roblox :red_square:

6 Likes

Why do you have ChangeHistoryService and Selection in the template code?

Because a lot of the plugins need to have history recording to execute undo and redos, I just did the service so they don’t have to, could have deleted it but I also don’t want to leave some people completely in the dark.

I changed one of my plugin scripts to make it a template, so some are just over sights that I decided to leave in.