Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is lerp broken?

    local p = script.Parent.Parent.Parent
	local c = p.Character
 	local larm = c["Left Arm"]
	Pos1 = Vector3.new(larm.Position)
    Pos2 = Vector3.new(script.Parent.Part.Position)

 	local Tool = script.Parent 
	Tool.Equipped:connect(function(Mouse)
	Mouse.Button1Down:connect(function()
		for ratio = 0,1,0.1 do
			local NewPosition = Pos1:lerp(Pos2, ratio)
			larm.Position = NewPosition
			wait()
		end    wait()
	end)
	end)

When I use that code, it makes the players left arm fall off.

1 comment

0

This is the exact problem I'm having but with welds.

1 answer

Interpolation has nothing to do with this, though you do have a mistake.

You're setting the original position when the script loads. That will not be where the arm is when the loop begins.

Remember to set the start position when you start moving it, probably.


Setting the .Position of a part breaks its joints.

Setting the .CFrame of a part instead will move the part, pulling all the things it's attached to with it.

If you want to change position of the arm, keep it attached to the player, but not lift the whole player along with it, you'll want to modify the joint attaching the arm to the body instead (Left Shoulder).

This discussion is preserved as it was. New answers, comments, and votes are closed.