Automate repetitive Roblox Studio tasks by writing your own plugins — toolbars, buttons, the Plugin API, and how to keep them safe.
You've learned to the game. Now the editor itself. If you've ever manually renamed fifty , or re-colored every wall, or rebuilt the same spawn platform twenty times — a plugin does that for you with one click. Plugins are the power tools of Roblox Studio, and this lesson shows you how to make your own.
A plugin is a (almost always with a GUI) that runs inside Roblox Studio to customize or automate the editor — it is not a game . never see it; it's a tool for the developer.
When are plugins useful?
If it's mindless, repeated, and rule-based, a plugin can likely do it — that's the tell.
Where does a Roblox Studio plugin run?
Plugins present themselves through the Studio interface as a toolbar (a row of buttons) with one or more buttons. This is the plugin's face:
Toolbar: "My Tools"
└── Button: "Build Platform" ← click it → your code runs
Create a under a Plugin object in the Studio tree — Studio recognizes it as a plugin. In that , grab the Plugin with plugin, then make a toolbar and a button:
local toolbar = plugin:CreateToolbar("My Tools")
local button = toolbar:CreateButton("Build Platform", "Click to build a platform", "rbxassetid://1234567890")
CreateToolbar(name) makes the row. CreateButton(name, tooltip, icon) adds a clickable button — the tooltip shows on hover, the icon is an image of your choice.
A plugin shows its tools as a row of clickable in the Studio interface.
A button alone does nothing. Connect its Clicked to the work you want done:
local toolbar = plugin:CreateToolbar("My Tools")
local button = toolbar:CreateButton("Build Platform", "Builds a platform", "")
local function buildPlatform()
local part = Instance.new("Part")
part.Size = Vector3.new(20, 1, 20)
part.Position = Vector3.new(0, 0, 0)
part.Anchored = true
part.Parent = workspace
end
button.Clicked:Connect(buildPlatform)
Every click runs buildPlatform — instant platform. This is the whole plugin pattern: create a button, connect Clicked, run your automation.
A plugin button should print a message when clicked. Write the line that connects the button's Clicked event to a 'hello' function.
local function hello()\n print("Hello from my plugin!")\nend\n\n-- wire the button's click to helloThe payoff: a plugin that names every selected with a prefix — the kind of mindless cleanup you'd otherwise do by hand for an hour.
local toolbar = plugin:CreateToolbar("Scene Tools")
local rename = toolbar:CreateButton("Prefix Selection", "Prefix selected parts", "")
local function prefixSelection()
local selection = game:GetService("Selection"):Get()
for _, object in ipairs(selection) do
if object:IsA("BasePart") then
object.Name = "Stage_" .. object.Name
end
end
end
rename.Clicked:Connect(prefixSelection)
Selection:Get() returns what's selected in the editor, IsA("BasePart") targets only , and a simple .. blows away the repetition of renaming each one.
Because Selection comes from a service that only exists inside the editor, this code can't run as a normal game — it has to be a plugin. That's the cleanest sign you're writing plugin territory.
The plugin should only rename objects that are BaseParts. Write the if-line that checks an object is a BasePart.
for _, object in ipairs(selection) do\n -- only handle objects that are BaseParts\nendFor more than one button, plugins can show PluginGui windows (like DockWidgetPluginGui) — a custom panel docked in the Studio layout. A simple pattern is to fill it from a PluginGui with a Frame:
local widget = plugin:CreateDockWidgetPluginGui(
"PrefixPanel",
DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Bottom, false, false, 200, 100)
)
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1, 0, 1, 0)
frame.Parent = widget
local label = Instance.new("TextLabel")
label.Text = "Select parts, then click Prefix in my toolbar."
label.Size = UDim2.new(1, 0, 1, 0)
label.Parent = frame
DockWidgetPluginGuiInfo.new(...) controls where the window docks and its size. Everything inside is just the GUI pattern you already know — frames, labels, buttons. The toolbar button and the dock window are two sides of the same plugin.
Start with a single toolbar button — most automations need nothing more. Reach for a dock window only when you need settings, text input, or multiple options.
Plugins have power, so treat them with care.
Safety considerations
Test and manage
Mass operations (renaming or deleting everything) are exactly where a bug becomes a disaster. Test on a scratch copy — and know that the Edit menu's Undo (Ctrl+Z) is your best friend while a plugin is in development.
Before installing and running a plugin from the internet, you should…
A complete plugin that removes every empty Folder in the — one click, instant cleanup:
-- Get the workspace
local dataModel = game
local toolbar = plugin:CreateToolbar("Clean Up")
local clean = toolbar:CreateButton("Remove Empty Folders", "Deletes folders with no children", "")
local function removeEmptyFolders()
local deleted = 0
for _, descendant in ipairs(dataModel.Workspace:GetDescendants()) do
if descendant:IsA("Folder") and #descendant:GetChildren() == 0 then
descendant:Destroy()
deleted += 1
end
end
print("Removed", deleted, "empty folder(s).")
end
clean.Clicked:Connect(removeEmptyFolders)
One click, and every empty Folder is gone — a tiny taste of the automation plugins unlock.
Extend the cleaner to also remove empty Models (no children and no ). Save it as a plugin and test it on a scratch place.
Selection and plugin don't exist in the game. Put the code in a plugin in Studio.Clicked. A button renders but does nothing until you call button.Clicked:Connect(...).IsA checks. A over a selection that assumes everything is a will crash the moment a Folder or Model is selected.That closes Advanced Studio — from 3D previews to one-click automation. Next: what to build on top of everything you've learned.