The code below is supposed to 'resize' a part depending on the distance between the mouse and the part. It glitches out and does some sort of a random spasm when the mouse moves, but overall works. How do I fix this?
Mouse.Button1Down:Connect(function() PlaceFirstPoint:Disconnect() Mouse.Move:Connect(function() OriginalMagnitude = (Mouse.Hit.p - GhostWall.Part.Position).magnitude print("Original: "..OriginalMagnitude) if OriginalMagnitude > (GhostWall.Part.Size).magnitude then GhostWall.Part:Resize(2, MathsLibrary.RoundAToB((GhostWall.Part.Position - Mouse.Hit.p).magnitude, I)) else GhostWall.Part:Resize(2, MathsLibrary.RoundAToB(-(GhostWall.Part.Position - Mouse.Hit.p).magnitude, I)) end NewMagnitude = (Mouse.Hit.p - GhostWall.Part.Position).magnitude print("New: "..NewMagnitude) end) end)