How would I do this?

But can’t you just get the player’s mouse and use Mouse.Hit.Position for this?

This will do the same thing internally, so yes.

Do you know if there is a way that I can make a UI dragging frame that shows the rectangle? Similar to how you can drag in ROBLOX Studio?

Do you want the rectangle to be on your screen or on the ground (In 3D)?

I want it to be on the players screen

I would recommend having it be on the ground, since if you look through a rectangle with your camera at an angle the shape along the ground may not be match up, think of a shadow. You can start drawing the rectangle and while the players mouse is down and if the selection is not valid when the mouse is released, delete it. You will need to change the raycast parameters to ignore the temporary rectangle.

No, I mean I just want a UI Element (Like a Frame) to show a visualization of the rectangle before its made.

This will be harder to do because the shape you see on your UI could be any 4 sided shape, not always a rectangle. If you do force it to be a rectangle, its shape wont match the shape actually drawn on the ground. You could still do this by calculating the four corners on the screen and drawing lines using frames, but it is going to be much harder and I don’t think you want to do that.

1 Like