How do I make a scale tool?

I have made a studio-like game, and it’s almost finished. I have a move and rotate tool, but I can’t figure out the Scale tool. Please help, thank you.

1 Like

Well, you could use your Move Tool script, but rather than change it’s position, change its size with Vectors?

1 Like

Hm… I’ll try to do that, and see if it works.

Edit: I don’t know how to do that, since my move script uses CFrame.

1 Like

Would it be possible if we see the script?

Yes, of course.

Handles = script.Parent:WaitForChild("MoveHandles")
local Part = script.Parent.Parent:WaitForChild("SelectedPart")
local CF
CF = script.Parent.Parent:WaitForChild("SelectedPart").Value.CFrame
local increment2 = 0.5
Handles.MouseButton1Down:connect(function()
    CF = Part.Value.CFrame
end)
Handles.MouseDrag:Connect(function(face, dist)
    Part.Value.CFrame = CF+Vector3.FromNormalId(face)*(math.floor(dist/increment2)*increment2)
	game.ReplicatedStorage:WaitForChild("SetPartCFrame"):FireServer(Part.Value,Part.Value.CFrame)
end)

What sort of values are the Values?

Oh, the part value is a objectvalue.

I am not an expert, I have very little knowledge on scaling like this, but maybe try replace the CFrames with Size and find a new RemoteEvent to fire?

Okay, I will try.

30 chars

EDIT: I somewhat did that, but it acts really weird.robloxapp-20200507-0741344.wmv (2.8 MB)

This could come in handy:

Hope this helped!

How would I get the delta?

30 chars

Let us see your sizing script?

Handles = script.Parent:WaitForChild("ScaleHandles")
local Part = script.Parent.Parent:WaitForChild("SelectedPart")
local Size
Size = script.Parent.Parent:WaitForChild("SelectedPart").Value.Size
local increment2 = 1
Handles.MouseButton1Down:connect(function()
    Size = Part.Value.Size
end)
Handles.MouseDrag:Connect(function(face, dist)
    Part.Value.Size = Size+Vector3.FromNormalId(face)*(math.floor(dist/increment2)*increment2)
	game.ReplicatedStorage:WaitForChild("SetPartSize"):FireServer(Part.Value,Part.Value.Size)
end)

Ah! Just used the default sizing tool in Roblox Studio, and noticed as you size something, the position also changed. Maybe try and reposition the part AS you size it.

I figured out how to make the scale tool myself.

Was I of any assistance? Hope I was!

Sorry, but, no. @brokenVectors did help though.

Hi, @TheWorstOne_2,

Would you be so kind to explain how you made the tool scale?

I am pretty sure a lot of us or at least I am curious about how you achieved this

2 Likes

Hello! After @brokenVectors reply, I searched up some info about Resize. Someone had made a resize tool, using resize. I feel like I didn’t “learn this” though, because it is someone elses code. But, if you would like to see the code, here it is:

local rHandle = script.Parent:WaitForChild("ScaleHandles")
local prev

print'ok'

rHandle.MouseButton1Down:Connect(function(normal)
	prev = 0
	print'down'
end)

rHandle.MouseDrag:Connect(function(id,distance)
	
	local delta = distance - prev
	local delta2 = math.abs(delta)
	if delta2 >= 1 then
		local sizD = math.floor(delta / 1) * 1
		
		local canCollide = rHandle.Adornee.CanCollide
		rHandle.Adornee.CanCollide = false
		if rHandle.Adornee:Resize(id,sizD) then
			
			prev = distance
		end
		rHandle.Adornee.CanCollide = canCollide
		
	end
end)
3 Likes