Snap objects with GUI

I’ve been working on a placement system, and one of the main features to add is mobile support.

Using math.floor, and the Hit property of the mouse, we can create a script that snaps models by their primary parts. Which I’m using right now for my placement system.

Now, this system only works for desktops and laptops, being the only devices that have a mouse. But, mobile devices doesn’t have a mouse to control. We can only use the ContextActionService or the UserInputService.TouchBegan to move that model. But, GUIs comes in handy here. Games like Welcome to Bloxburg and RoVille use a GUI snap option, where players can hold the button and move it, while the model moves with the UI itself. The problem is, primary parts use cframe, and GUIs use UDim2 to move their location.

Here’s a preview of what I want to make:

As you can see, if you play bloxburg on your phone, you will get the idea of what I’m trying to do.

I just found tutorials on youtube to drag the UI with the mouse. which is not what I need.

Any help? Thanks.

Any solutions are appreciated, thanks!