How to Change Selection to Part based, regardless of Model Status

Hey developers! I am making a plugin, and was wondering if there is a way to make the user using the plugin, to select a part, regardless if its in a model. Kinda like when you use the Weld constraint tool, your able to select any part, even if its in a model.

Any help is much appreciated!

To be fair, ALT + Click is easier than clicking a button then clicking an object

Ah, nice shortcut.

Although I want to be able to force this behavior in a plugin.

raycast from cursor and use Selection:Set() on click

something like this

--listen for a click
--send raycast
--select hit part