Introduction
Hello developers, today I decided to share a very useful plugin that I’ve made. Currently ui selection sucks. You have to be already selecting ui to select ui again. If you are not selecting ui and you click on a gui object, it does not get selected.
This plugin aims to fix the problem. Now, you can select ui regardless of if you were previously selecting ui.
Demonstration
Note: The plugin has a PluginToolbarButton so you can disable the plugin if needed.
Normal Select: Won’t select because we are not on the ui layer
UI Select Plugin: Selects regardless of whether we are on the ui layer
Explanation
The plugin is very simple consisting of only 20 lines. When a user clicks, UserInputService detects that and get’s any ui at the mouse’s position. If there is ui, then select it.
Code
local toolbar = plugin:CreateToolbar("UISelect")
local Button = toolbar:CreateButton("UI Select", "Allows you to select user interface without having to be on the ui layer.", "rbxassetid://7143000156");
local enabled = true
Button:SetActive(enabled)
Button.Click:Connect(function()
enabled = not enabled
Button:SetActive(enabled)
end)
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and enabled then
local position = UserInputService:GetMouseLocation()
local guis = game.StarterGui:GetGuiObjectsAtPosition(position.X,position.Y)
guis = (game.Selection:Get()[1] ~= guis[1] and guis[1]) and game.Selection:Set({guis[1]})
end
end)
Conclusion
This plugin is very helpful when it comes to ui design. I made a plugin install if you want to use it for yourself. Thanks for reading and have a nice day.