Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Resizing a part depending on the position of the mouse?

Asked by 6 years ago

I have a part called Part1, which does not change position. I want it to resize by how far away the mouse is, compared to the position of Part1.

Mouse.Move:Connect(function()
    Part1:Resize(2, (Part1.Position - Mouse.Hit.p).magnitude)
end)

My current code resizes Part1, but only increasing the size. If the mouse moves away from Part1, the size increases correctly.

If the mouse moves closer to Part1, the size still increases when I want it to decrease. How do I change my code to do this?

Answer this question