Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I fix ropes teleporting parts to themselves?

Asked by
Raccoonyz 1092 Donator Moderation Voter
4 years ago
Edited 4 years ago

Hi. I'm making a script that adds a rope to any unanchored objects that come by. I want the rope to make the unanchored object swing across. However, whenever I try to do it the rope just teleports the part to the position without swinging it. That isn't what I want it to do and so I was curious how to fix this. My script:

local part2 = script.Parent
local attach2 = script.Parent.Parent.Conrope.Attachment
local conrope = script.Parent.Parent.Conrope

local function onModelTouched(part)
    if part.Name == "Part" then
 local attachment = Instance.new("Attachment")
 attachment.Parent = part
 local rope = Instance.new("RopeConstraint")
 rope.Parent = conrope
 rope.Attachment0 = attach2
 rope.Attachment1 = attachment
 rope.Restitution = 0.5
 rope.Length = 5
 rope.Visible = true
wait(5)
rope:Destroy()
attachment:Destroy()
end
end
part2.Touched:Connect(onModelTouched)

Answer this question