How do I make this model move to a certain position while being welded? EX: lerping to a position

I’m trying to lerp this stand model in front of me so that it can punch, but when I try that while it’s being welding to the character’s torso, it starts getting buggy movements. I removed the weld right before it lerps to the position. I don’t know a good solution of how to lerp a model while being welded. Any solutions that I could do?

https://gyazo.com/6451be5b0156e399b01451c56d407180

wait(.5)
local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
prevWeld:Destroy()
			
for i=0,1,0.1 do
wait()
Stand:WaitForChild("HumanoidRootPart").CFrame = Stand:WaitForChild("HumanoidRootPart").CFrame:lerp(HumanoidRP.CFrame * CFrame.new(2,1,3), 0.5)
end
1 Like

Is it intensional that you are using 0.5 in the percentage spot instead of the “i” from your for loop? This means that it will not move smoothly, but will remain perfectly between your start and end point for the entirety of the for loop.

To create the Tween-like effect using Lerping, you just have to plug the for loop value into the :Lerp().

for i=0,1,0.1 do
wait()
Stand:WaitForChild("HumanoidRootPart").CFrame = Stand:WaitForChild("HumanoidRootPart").CFrame:lerp(HumanoidRP.CFrame * CFrame.new(2,1,3), i)
end

Oh, I see. Thank you for telling me this, but the model still glitches when it lerps.

1 Like

Have you tried using SetPrimaryPartCFrame on the Stand Model, instead of just setting the .CFrame of HumanoidRootPart?

You will need to set the PrimaryPart of the Stand to the HumanoidRootPart, if you haven’t already, for this to work.

Stand:SetPrimaryPartCFrame(Stand:WaitForChild("HumanoidRootPart").CFrame:lerp(HumanoidRP.CFrame * CFrame.new(2,1,3), i))
1 Like

It still kinda bugs out. (30 characters)