I am trying to make a selection box when you drag your mouse. Like you do on your desktop to select multiple icons.
I have the basics of the code down but my problem is when I drag in any other quadrant than the 4th I the part doesnt position correctly. By quadrant I mean, think of a graph and the bottom right square is quadrant 4.
Heres my code so far.
local SelectionStartPosition
local SelectionEndPosition
function SelectionBegan()
SelectionStartPosition = Mouse.Hit.Position
end
function SelectionEnded()
SelectionEndPosition = Mouse.Hit.Position
local SelectionPart = Instance.new("Part")
SelectionPart.Size = Vector3.new(math.abs(SelectionStartPosition.X - SelectionEndPosition.X), math.abs(SelectionStartPosition.Y - SelectionEndPosition.Y), math.abs(SelectionStartPosition.Z - SelectionEndPosition.Z))
SelectionPart.Position = SelectionStartPosition - Vector3.new(SelectionPart.Size.X/2, 0, SelectionPart.Size.Z/2)
SelectionPart.Anchored = true
SelectionPart.Parent = workspace
end
Mouse.Button1Down:Connect(SelectionBegan)
Mouse.Button1Up:Connect(SelectionEnded)
Thank you for your time :)
Heres an image of a chart just in case your curious. http://aventalearning.com/content168staging/2006AlgebraIA/images/u4_s1_3.gif
Also heres a gif of the top bottom thing I was talking about. https://gyazo.com/2289dd3041144fd777db401f6939d944
[UPDATE] I have managed to solve the scaling problem, by converting the scale numbers into positive numbers that seems to work :) Now I am trying to solve the positioning problem.

9 comments
Nice question
I updated it, I have been messing around with it for a little while but now ive come across a different problem. Also thank you for the up vote :)
I had this same question, and a satisfactory solution for me was to just change the size of a cylinder mesh through a for I loop. I wanted the cylinder to go from being flat to rising in height from bottom to top, not increasing in size from the center.
I almost have it solved on my own, Ill paste the solved code here when im done just incase anyone ever wants to see the math for it.
u could also just google how those desktops do it
they have like hunreds of them in lua
I think you should mess with Anchor Point or something
Have you tried to make a replica of what the part would look like at first? It be better to help analyze your problem in my opinion,
Great idea