FroDev1002
(FroDev)
September 18, 2024, 12:35am
#1
So as I am working on a little something, I need to be able to do, well this, and Ik there are resources out their, but due to what Im doing it would be best to custom code it.
Now my question is how do I do it??
The main part I need to know how to do is well, for instance the move tool, there are little arrows next to the selected part, and when you grab and drag it, it well does whatever, how can I make that sorta thing?
7z99
(cody)
September 18, 2024, 12:49am
#2
Move and scale are under the “Handles” instance via Style property, rotate is under the “ArcHandles” instance.
Rotate:
Hello there!
There are plenty of free-modeled rotate tools you can take a look at and see how you can implement one of these systems.
The first parameter of the MouseDrag event is the axis that the player dragged their mouse on. The second one is just the RelativeAngle (which has no wiki documentation so I don’t know what it is) so you can just use if statements and detect which axis they dragged on and then you can perform CFrame operations on them using basic math.
I created a quick prototy…
Movement (shameless plug lol):
Using handles is a lot simpler than that.
Just save the initial CFrame of the part, then use the handles.MouseDrag event to offset the part’s CFrame from the initial CFrame when the drag started.
local handles = script.Parent:WaitForChild('Handles')
local adornee = handles.Adornee
local initialPartCFrame
handles.MouseButton1Down:Connect(function(face: Enum.NormalId)
initialPartCFrame = adornee.CFrame -- save the part's CFrame
end)
handles.MouseDrag:Connect(function(face: Enum.NormalId, di…
Resize:
Here’s a working “local resize” tool: ResizeTool.rbxm (2.1 KB)
Drag-and-drop into an open place in Studio to insert it.
The relevant code is this:
handles.MouseButton1Down:Connect(function()
local dragC, mouseUpC
local prevDist = 0 --The distance from last time handles.MouseDrag fired
dragC = handles.MouseDrag:Connect(function(face, distance)
local deltaDist = (distance - prevDist) --How far the handle was dragged
local resizeDir = Vector3.FromNormalId(face)
if resizeDir.X == …
FroDev1002
(FroDev)
September 18, 2024, 12:50am
#3
cody:
Style property
whats that? And how do I make one? I see how to make the arc handles though so thanks
7z99
(cody)
September 18, 2024, 12:51am
#4
Instead of making an ArcHandles, you would make a normal “Handles”, parent it under the PlayerGui, and adorn it to the relevant part/model
FroDev1002
(FroDev)
September 18, 2024, 12:56am
#5
Ahhh I see cool. Anyway to set the Adornee to multiple parts with out them all being parented to a model?
7z99
(cody)
September 18, 2024, 12:57am
#6
Nope, would have to be a model
Hmm Ill think of a work around.
On the subject of moving stuff, you know how in the model tab theres something called Move, which is how many studs something will be moved by, well anyway to get this value?
7z99
(cody)
September 18, 2024, 1:04am
#8
Common workaround is to use an invisible part and create a bounding box around the selection, then use this for the adornee instead.
FroDev:
On the subject of moving stuff, you know how in the model tab theres something called Move, which is how many studs something will be moved by, well anyway to get this value?
1 Like