Get/Select Ribbon Tool, always prints an error

Hello Developers,

I’ve encountered a perplexing issue while developing my plugin, and it’s been quite a roadblock. My plugin allows users to edit and design UIs, so basic interactions like selecting, deleting, and handling keyboard events are crucial.

The core problem arises when a user attempts to delete a UI element within the plugin. Due to an unexpected selection synchronization, selecting an element in my plugin also selects it in the main workspace without the user’s knowledge. Consequently, if the user then presses the delete key, they inadvertently delete a part in the workspace instead of the intended UI element within the plugin. This is a critical flaw in the user experience.

I’ve tried to programmatically control Ribbon tools—specifically, using Get or Select methods, or even attempting to set them to None or another state—but I consistently encounter errors. Some staff members have suggested this was fixed in the 2024 updates, but my experience indicates otherwise. I’ve scoured forums and documentation for a solution, but there’s a distinct lack of information regarding this specific issue.

Furthermore, even attempting to use the command bar for these actions results in the same errors. Both Get and Select commands print an error when executed.

Useful Links:
:GetSelectedRibbonTool()
:SelectRibbonTool()
Roblox Staff mentions it’s fixed
Here’s my code:

local SelectionService = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("GuiEditor")
local button = toolbar:CreateButton("", "Editor", "rbxassetid://16338608262")

local Gui = script.Parent:WaitForChild("GuiEditor")

button.Click:Connect(function()
	if Gui.Parent ~= game:GetService("CoreGui") then Gui.Parent = game:GetService("CoreGui")  end
	plugin:SelectRibbon(Enum.RibbonTool.None, UDim2.new(0,0,0,0)) -- Error
	Gui.Enabled = not Gui.Enabled
end)

Error message:

 SelectRibbon is not a valid member of Plugin "user_GuiEditor.rbxmx"  -  Edit - Createplugin:10
 Stack Begin  -  Studio
 Script 'user_GuiEditor.rbxmx.GuiEditor.Createplugin', Line 10  -  Studio
 Stack End  -  Studio

Possible fix so you don’t select stuff and delete stuff while interacting with plugin:

local db = false
SelectionService.SelectionChanged:Connect(function()
	if Gui.Enabled == true and db == false then
		db = true
		SelectionService:Remove(SelectionService:Get())
		db = false
	end
end)

Expected behavior

It should change Ribbon tool to what it should be.

1 Like

Hi there @KSA_Developer,

I think the problem is just that you have the wrong name for the function call.
It’s not:
plugin:SelectRibbon(Enum.RibbonTool.None, UDim2.new(0,0,0,0))
rather its:
plugin:SelectRibbonTool(Enum.RibbonTool.None, UDim2.new(0,0,0,0))

SelectRibbonTool, not SelectRibbon.

I was able to recreate both the error and a fix in my own plugin.

Please try and report back if this helps you?

1 Like

With the above fix to call SelectRibbonTool() can you get the behavior you want or is there still a remaining bug?

Because I didn’t fully undesrtand your initial problem:
"The core problem arises when a user attempts to delete a UI element within the plugin. Due to an unexpected selection synchronization, selecting an element in my plugin also selects it in the main workspace without the user’s knowledge. Consequently, if the user then presses the delete key, they inadvertently delete a part in the workspace instead of the intended UI element within the plugin. "

I mean, if you select something and delete it, then it should be deleted right?
Or was the problem that without SelectRibbonTool(none) that you end up deleted extra objects other than your UI element?

Haha, it was my mistake, anyway thanks for replying and helping me!! there was never bug but it was personal mistake, and don’t worry about what i said, i was just overreacting lol.

No problem, we all make mistakes and I’m happy to help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.