RopeConstraintProblem

I wanted to make a rope constraint from my tool to the part in the workspace.
So i scripted this___

script.Parent.Parent.Equipped:Connect(function()
	wait(1)
	local at1 = Instance.new("Attachment")
	at1.Parent = script.Parent
	local at2 = Instance.new("Attachment")
	at2.Parent = game.Workspace.Part1
	local rope = Instance.new("RopeConstraint")
	rope.Length = rope.CurrentDistance
	rope.Attachment0 = at1
	rope.Attachment1 = at2
	rope.Parent = game.Workspace.Part1
	rope.Visible = true
end)

and it did something like this ___

I tried to fix it. It didnt happen.
Then i used a rod constraint. And it worked somewhat like this__

script.Parent.Parent.Equipped:Connect(function()
	wait(1)
	local at1 = Instance.new("Attachment")
	at1.Parent = script.Parent
	local at2 = Instance.new("Attachment")
	at2.Parent = game.Workspace.Part1
	local rope = Instance.new("RodConstraint")
	rope.Length = rope.CurrentDistance
	rope.Attachment0 = at1
	rope.Attachment1 = at2
	rope.Parent = game.Workspace.Part1
	rope.Visible = true
end)

I want to make it so that the length of the rope does not change. Please do kindly help me.

There must be some code missing that you didn’t share. Is that it?

Yes that is it. I promise you.

Instead of using CurrentDistance, try getting the magnitude between the RootPart position and the part’s position, and set the rope’s length to that.

Length = (Rootpart.Position - Part.Position).Magnitude

1 Like

Perhaps add a stud to the length. It will be exactly taught when you set it.

1 Like

Thanks for the help. I appreciate it. :grin: :grin: :grin: :grin:

It was solved.

local at1 = Instance.new("Attachment")
at1.Parent = script.Parent
local at2 = Instance.new("Attachment")
at2.Parent = game.Workspace.Part1
local rope = Instance.new("RopeConstraint")
script.Parent.Parent.Equipped:Connect(function()
	wait(1)
	rope.Length = rope.CurrentDistance
	rope.Attachment0 = at1
	rope.Attachment1 = at2
	rope.Parent = game.Workspace.Part1
	rope.Visible = true
	rope.Length = (script.Parent.Position - game.Workspace.Part1.Position).Magnitude
end)