Part resize script buggy

I want to create a part which can be resized using “Handles”. The issue is that it is buggy, and as you resize, the “resize speed” increases, and it also doesn’t behave like the studio resize tool.

I have searched the DevForum for the solution of this, but I only found solution on how to make “Move Handles” work. I cannot find anything about the resize handles.

This is the script I made up till now.

local handles= script.Parent

local part = script.Parent.Adornee

handles.MouseDrag:Connect(function(id,distance)

local delta = math.floor(distance / .5) * .5

print(delta)

part:Resize(id,delta)

end)

Please tell me what is the problem and what is the solution.
Thanks!

The distance passed to the callback is the change in distance since the handle was clicked. You’ll probably need to use MouseButton1Down to get resizing to work correctly.

Can you please give me an example?