How do you make a rope that when clicked on the first part, attach to your hand and then when clicked again connects to another brick? I’ve got a rope already as shown in the image below. Part one is called Base and Part two is called Target.
I’m assuming you’d use a ClickDetector for moving the rope.
What I would do it when you click on part one, create an attachment on the player’s right arm using Instance.new
. Then, when you click on another part with a ClickDetector, you can delete the attachment from the player’s arm and then create a new one in the part.
If you want to make it go back and forth from the hand to the part, you can use a value function to rotate between values, such as:
local val = 0
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if val < 1 then
val = val + 1
else val = 0
end
if val == 0 then
-- delete the attachment you made in val == 1 (still add this even on first click)
-- create new Attachment in arm / part and delete the old one
-- then make the new attachment one of the rope's attachments.
if val == 1 then
-- delete the attachment you just made in val == 0
-- add a new one to the other part
-- make the new attachment a rope attachment
As I do not work with welds or rope very often, I have a very limited understanding. However, I hope this helps you.
Ok great thanks. Just to be clear, when val = 0 its in the off position and when val = 1 it is on?
Yeah. Of course, you can change these to however you want, and add more than two options.