RopeConstraintSmooth

I made a Grappling hook with the following code

 UserInputService = game:GetService("UserInputService")
local at1 = Instance.new("Attachment")
at1.Position = Vector3.new(1,0,0)
at1.Parent = script.Parent.Parent
print(at1.Parent)
local at2 = Instance.new("Attachment")
at2.Parent = game.Workspace.Part1
local rope = Instance.new("AlignPosition")
local visiblerope = Instance.new("RopeConstraint")
script.Parent.Parent.Parent.Equipped:Connect(function()
	script.Parent.Parent.Parent.Activated:Connect(function()
		visiblerope.Restitution = 0
		visiblerope.Length = (at1.Parent.Position - at2.Parent.Position).Magnitude
		visiblerope.Attachment0 = at1
		visiblerope.Attachment1 = at2
		visiblerope.Parent = game.Workspace.Part1
		visiblerope.Visible = true
		rope.Attachment0 = at1
		rope.Attachment1 = at2
		rope.Parent = game.Workspace.Part1
		rope.Visible = true
		rope.MaxVelocity = 70
		while wait(0.01)do
			visiblerope.Length = (at1.Parent.Position - at2.Parent.Position).Magnitude 
		end
	end)
	script.Parent.Parent.Parent.Deactivated:Connect(function()
		rope.Attachment0 = nil
		rope.Attachment1 = nil
		visiblerope.Attachment0 = nil
		visiblerope.Attachment1 = nil
	end)
	
end)

It works fine but when i grapple, the rope is longer than the distance between me and the Object


Is there any way that i can make the rope the streched with no extra length.
Please do kindly help me.