Collapse Sidebar


This function creates a new PluginMenu, which is a context menu that can be shown in Studio that displays a list of PluginAction|PluginActions and supports submenus.

In order for PluginMenus to work as expected, they must be created using this function.

See also

  • articles/Intro to Plugins, an introductory article to plugin use and development
  • PluginAction, an object that represents a generic performable action in Roblox Studio, with no directly associated Toolbar or Button.
  • Plugin/CreatePluginAction, creates a PluginAction
  • PluginMenu/Title, the text to be displayed when used as a sub menu
  • PluginMenu/Icon, the icon to be displayed when used as a sub menu
  • PluginMenu/AddAction, adds the given action to the menu
  • PluginMenu/AddNewAction, creates a temporary action that is hidden from Studio’s customize shortcuts window
  • PluginMenu/AddMenu, adds the given menu as a separator
  • PluginMenu/AddSeparator, adds a separator between items in the menu
  • PluginMenu/Clear, clears the menu
  • PluginMenu/ShowAsync, shows the menu at the mouse cursor. Yields until either an item is selected or the menu is closed. The selected action fires its Triggered event


Name Type Default Description


Unique ID for the menu

The text to be displayed when used as a sub menu

The icon to be displayed when used as a sub menu


Return Type Summary

The created PluginMenu instance

Code Samples

Creating a PluginMenu and PluginMenuAction

This code sample visualizes how PluginMenu|PluginMenus and PluginAction|PluginActions behave when created for a Plugin. Outside of this example, you should not parent the plugin or its functional components to the game’s workspace.

In order to work as expected, the code block must but pasted into the command bar, but only once. Consecutive attempts at executing the code in the command bar will result in an error because a plugin cannot create more than one PluginMenu with the same id.

After executing the code, changing the created BoolValue in the game’s workspace via the Explorer window opens the plugin’s menus. Selecting an action from the menus the function connected to the trigger signal.

Example Plugin in Studio Explorer Window

-- This code can be pasted into the command bar, but only once.

local plugin = plugin or getfenv().PluginManager():CreatePlugin()
plugin.Name = "Plugin"
plugin.Parent = workspace

local pluginMenu = plugin:CreatePluginMenu(math.random(), "Test Menu")
pluginMenu.Name = "Test Menu"

pluginMenu:AddNewAction("ActionA", "A", "rbxasset://textures/loading/robloxTiltRed.png")
pluginMenu:AddNewAction("ActionB", "B", "rbxasset://textures/loading/robloxTilt.png")

local subMenu = plugin:CreatePluginMenu(math.random(), "C", "rbxasset://textures/explosion.png")
subMenu.Name = "Sub Menu"

subMenu:AddNewAction("ActionD", "D", "rbxasset://textures/whiteCircle.png")
subMenu:AddNewAction("ActionE", "E", "rbxasset://textures/icon_ROBUX.png")


pluginMenu:AddNewAction("ActionF", "F", "rbxasset://textures/sparkle.png")

local toggle = Instance.new("BoolValue")
toggle.Name = "TogglePluginMenu"
toggle.Parent = workspace

local function onToggled()
	if toggle.Value then
		toggle.Value = false
		local selectedAction = pluginMenu:ShowAsync()
		if selectedAction then
			print("Selected Action:", selectedAction.Text, "with ActionId:", selectedAction.ActionId)
			print("User did not select an action!")