Resizing a part on one face in a loop issue

So I know that when I resize the part i need to move it half of how much I resized it, but problem is that doesnt work in a loop and it just goes crazy, here is my code

Video Of Issue:

1 Like

What’s supposed to happen? charscharschars

Uh so basically making the part as long as the distance between the part and the mouse

1 Like

So like this sorry for the bad drawin

BTW you can format code by enclosing it in ``` or pressing the code-formatting button:

Drawing is perfect xD

Here’s how it can be done:

    if not holding then return end
    --The start point is the center, moved back by half it's length
    local partStartPoint = heldPart.Position - heldPart.CFrame.LookVector * heldPart.Size.Z / 2
    local partEndPoint = mouse.Hit.Position
    heldPart.Size = (partEndPoint - partStartPoint).Magnitude
    --This places the part's center at partStartPoint
    heldPart.CFrame =, partEndPoint)
    --This moves the part forwards by half it's length
    heldPart.CFrame += heldPart.CFrame.LookVector * heldPart.Size.Z / 2
1 Like

Had to make a few adjustments and changes but, it’s working now!

Thank you so much for your time, I appreciate it greatly

My Updated Code :

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.