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.