How do you detect if someone clicked "Insert Part"

Hey I am looking for a way to figure out if someone has clicked “Insert Part” on the toolbar, this is for a plugin of mines i am scripting.

The only issue i am encountering is to find a way to detect that click on the “insert part”
So i can apply settings to it.

1 Like

Just like you would with a normal button? MouseButton1Click:Connect or also MouseButton1Down:Connect. Keep in mind you can’t have local scripts in plugins.

Thats not what i men’t, I understood you need to use those functions but which button is it… I can’t find it.

Does it not have a pre-assigned button name i can use?

if you’re confused on how to build UI in plugins, you can just do it this way:
First, create your UI like you would in a normal game inside the plugin script (I usually have a background root frame that’s set to {1, 0} {1, 0} so it fits the plugin window):
image
And then just mount it to the plugin gui:

local gui = plugin:CreateDockWidgetPluginGui("Whatever", yourGuiInfo)
script.PluginGui.Background.Parent = gui

And then use that

Is there no way to see if this button is clicked : image

1 Like

Or For example the " Insert Part right click " image

1 Like

Never mind, found a Solution, just use ‘workspace.ChildAdded’ to detect the New part. Simple fix. And no need to check the button.