How does roblox calculate placing a part in studio?

I have a plugin that allows me to place props down with UI. I want it to be identical to the placement that happens when u press a model from toolbox or add a new part into the workspace. How do they calculate placing down models and parts in studio?

This looks like an AI generated response, I wont hold you for it though if it helps me it helps me.

This doesnt solve my problem exactly. It requires you to input a position into the function and how would I get that position to begin with? Like I said I am trying to make it identical or as close as possible to how roblox’s works.