CreatePluginAction's Code Samples are for the wrong method

I’m referring to this page: Plugin | Documentation - Roblox Creator Hub

The code sample on that page:

    -- 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 ="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!")

Is for CreatePluginMenu and AddNewAction. The code sample doesn’t even use CreatePluginAction.


Yeesh, I took a look at the PluginMenu/PluginAction group of pages and they could all do with some consistency updates. I’ll see what I can do in the short term and add these to my bigger list of pages that need improvement.

I’ll update this thread when some changes are made! Thank you for bringing this to my attention

1 Like

I’ve created a new code sample for the Plugin:CreatePluginAction() function. It should be live within the next few days! :slight_smile: