I made a resize tool for my filtering enabled game but I appear to be having problems with it.
when handling the handles I wanted to change the resize increment. I wanted it to change parts size by 0.5. but as I was tinkering with it I had no luck.
local tool = script.Parent
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
enabled = true
local selectionBox
local selectionLasso
local handles
local previousDistance
local originalpart
local buttonupconnection
local tempart
function onHandlesDown(normal)
previousDistance = 0
end
function onHandlesDrag(normal, distance)
if handles.Adornee then
-- print(handles.Adornee.ResizeIncrement)
local delta = distance - previousDistance
if math.abs(delta) >= handles.Adornee.ResizeIncrement then
local sizeDelta = math.floor(delta / handles.Adornee.ResizeIncrement + 0.5) * handles.Adornee.ResizeIncrement
if handles.Adornee:Resize(normal, sizeDelta) then
previousDistance = distance
--send changes to server
buttonupconnection = mouse.Button1Up:connect(function()onButton1Up(mouse,handles.Adornee)end)
--
end
end
end
end
function onButton1Up(mouse,part)
if part and script.Parent.Parent == plr.Character then
local size = part.Size
local cfr = part.CFrame
script.Parent.PartChange:FireServer(originalpart,size,cfr)
end
end
function onButton1Down(mouse)
local findpart = game.ReplicatedStorage.BuildingParts:FindFirstChild(mouse.Target.Name)
if tempart then
tempart:Destroy()
end
if mouse.Target == nil or mouse.Target.Locked or not findpart then
print("nil")
selectionBox.Adornee = nil
selectionLasso.Part = nil
handles.Adornee = nil
else
print("not nil")
originalpart = mouse.Target
tempart = findpart:Clone()
tempart.CanCollide = false
tempart.Anchored = true
tempart.Transparency = 0.6
tempart.Size = originalpart.Size
tempart.Parent = game.Workspace
tempart.CFrame = originalpart.CFrame
tempart.BrickColor = BrickColor.new("Lime green")
selectionBox.Adornee = tempart
selectionLasso.Part = tempart
handles.Adornee = tempart
handles.Faces = tempart.ResizeableFaces
end
end
function onEquippedLocal(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
local character = script.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
selectionBox = Instance.new("SelectionBox")
selectionBox.Color = BrickColor.Blue()
selectionBox.Adornee = nil
selectionBox.Parent = player.PlayerGui
selectionLasso = Instance.new("SelectionPartLasso")
selectionLasso.Name = "Model Delete Lasso"
selectionLasso.Humanoid = character.Humanoid
selectionLasso.Parent = game.workspace
selectionLasso.Part = nil
selectionLasso.Visible = true
selectionLasso.archivable = false
selectionLasso.Color = BrickColor.Red()
handles = Instance.new("Handles")
handles.Color = BrickColor.Blue()
handles.Adornee = nil
handles.MouseDrag:connect(onHandlesDrag)
handles.MouseButton1Down:connect(onHandlesDown)
handles.Parent = player.PlayerGui
end
function onUnequippedLocal()
selectionBox:Destroy()
selectionLasso:Destroy()
handles:Destroy()
if handles.Adornee then
handles.Adornee:Destroy()
end
if buttonupconnection then
buttonupconnection:Disconnect()
end
end
tool.Equipped:connect(onEquippedLocal)
tool.Unequipped:connect(onUnequippedLocal)
the function onhandlesdrag is the main concern. I tried simply changing “sizedelta” to a number less than 1 such as 0.5, but that didn’t work. I tried changing the resize increment to a number such as 0.5, but no luck. I read up a post about the handles object. and it said that the resizeincrement can only be 1. is this true? and is there any way to change this?
test file.rbxl (21.2 KB)