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:
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:
What’s supposed to happen? charscharschars
Uh so basically making the part as long as the distance between the part and the mouse
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:
game:GetService("RunService").Heartbeat:Connect(function()
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 = CFrame.new(partStartPoint, partEndPoint)
--This moves the part forwards by half it's length
heldPart.CFrame += heldPart.CFrame.LookVector * heldPart.Size.Z / 2
end)
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.