I made a resize handle which works but it doesn’t resize through other parts. The problem is with BasePart:Resize().
Is there a way to make the part resize through other parts without making it not collidable?
Here is a screenshot:
https://prnt.sc/puj67r
I am unable to resize it upwards and downwards. I can resize left,right,front,back though.
Code:
local prev
rHandle.MouseButton1Down:Connect(function(normal)
prev = 0
end)
rHandle.MouseDrag:Connect(function(id,distance)
print("fired")
local delta = distance - prev
local delta2 = math.abs(delta)
if delta2 >= 1 then
local sizD = math.floor(delta / 1) * 1
if rHandle.Adornee:Resize(id,sizD) then
print("resized")
prev = distance
end
end
end)
In the output it does print “fired” when I try to resize it upwards but it doesn’t print “resized”.
If it isn’t possible is there an alternative which is like BasePart:Resize() but it resize through other parts?
Help is appreciated.
2 Likes
This seems obvious so I apologize if this comes off as offensive,
but have you tried doing this?
BasePart.Size = Vector3.new(x,y,z)
EDIT:
Oh wow, that’s really cool.
I’ve never experemented with Handles before!
This is what worked for me:
rHandle = script:WaitForChild('Handles')
print'ok'
rHandle.MouseButton1Down:Connect(function(normal)
prev = 0
print'down'
end)
rHandle.MouseDrag:Connect(function(id,distance)
print("fired")
local delta = distance - prev
local delta2 = math.abs(delta)
if delta2 >= 1 then
local sizD = math.floor(delta / 1) * 1
print(id,sizD)
local canCollide = rHandle.Adornee.CanCollide
rHandle.Adornee.CanCollide = false
if rHandle.Adornee:Resize(id,sizD) then
print("resized")
prev = distance
end
rHandle.Adornee.CanCollide = canCollide
end
end)
You just disable collision and then re-enable it again.
It happens so fast that it doesn’t really have an effect on anything else.
EDIT2: Made code a little better
2 Likes
Wow. I wonder why I thought that it would stay uncollide until I stop dragging the mouse.