Resize an object in game?

I am making a game which includes a resize thing just like in Roblox Studio which you can use to resize parts in game.

But I don’t know how to do it. I tried searching the internet for it but I didn’t find anything about this.
The game called “Build a Boat For Treasure” has this resize thing. Can someone tell me how can I put this in my game? Here is a screenshot:

https://gyazo.com/f6e4fa04dcc5461589b776b2f3d0c09c

Any help is appreciated!

1 Like

Roblox has objects which make those, Handles for the resize, ArcHandles for rotation, for the move handles there is the Style property. These objects do not move/resize/rotate by default, you would have to create a script for that.

2 Likes

How can I do that though. I cannot find any tutorials for Handles on the internet.

They both have a MouseDrag event which should fire if they start dragging one of the handles.
MouseDrag for Handles
MouseDrag for ArcHandles

1 Like

How do I move the part in the direction of the of the face selected? Like if the top face is selected how I make it move to the top?

The direction is passed through as a normal id.
I created a simple script which uses the move handles, although it probably should be tweaked.

script.Parent.MouseDrag:Connect(function(direction,distance)
	script.Parent.Adornee.CFrame = script.Parent.Adornee.CFrame*CFrame.new(Vector3.FromNormalId(direction)*((distance < 0 and -((-distance)^(1/3))) or (distance^(1/3)))/math.pi)
end)
2 Likes

I am not so skilled in scripting so I don’t understand the math in that script. Can you explain a little bit or no? Anyway thanks for the replies.

Basically, it gets the direction with Vector3.FromNormalId() and then multiply by the cube root of the distance (i check if its negative so it works in all directions) and then divides by pi.
Dividing by pi is so it looks like it moves more accurately with the mouse, and I take the cube root so the object isn’t completely moved off your screen when you drag the mouse out into the sky.
Multiplying by the original CFrame so it works with any orientation of the original part.

2 Likes

Well I will probably never understand that so I can only copy paste the script inside my handle. Thanks for the help!