Erratic Behaviour in 24 segment rope

I’m trying to recreate the whiplash from iron man 2
Here I am using a neon cylinder with 24 bones
And a seperate 24 parts that are linked up together by rope constraints
You may think all is well, but it is prone to erratic behaviour:
The rope segments properties:
The script used to automate the creation of the rope segments:

for i=1,24 do
	local par ="Part",workspace)
	par.Position =,.5*i,0)
	par.Size =,.4,.1)
	par.Name = "gar "..i
	local at0 ="Attachment",par)
	local at1 ="Attachment",par)
	at0.Position =,-.2,0)
	at0.Name = "at0"
	at1.Position =,.2,0)
	at1.Name = "at1"
	if i>1 then
		local rope ="RopeConstraint",par)
		rope.Restitution = .2
		rope.Length = .1
		rope.Attachment0 = at0
		rope.Attachment1 = workspace["gar "..i-1].at1

The script that aligns the cylinder neon with the rope segments:

local mou = game.Players.LocalPlayer:GetMouse()
local tool = script.Parent
local gar = false
	gar = true
		script.Parent.Circle.Bone.WorldPosition = tool["gar 1"].Position
		script.Parent.Circle.Bone.WorldOrientation = tool["gar 1"].Orientation

		for i = 1,9 do
			script.Parent.Circle["Bone.00"..i].WorldPosition = tool["gar "..i+1].Position
			script.Parent.Circle["Bone.00"..i].WorldOrientation = tool["gar "..i+1].Orientation
		for i = 10,23 do
			script.Parent.Circle["Bone.0"..i].WorldPosition = tool["gar "..i+1].Position
			script.Parent.Circle["Bone.0"..i].WorldOrientation = tool["gar "..i+1].Orientation
	until gar == false
	gar = false

The cylinder is welded to the handle

Video of erratic behaviour:

My need:
How can I fix this?
Are this other ways to improve this (other than the erratic behaviour)

- Br, iSyriux

1 Like

I think the problem is because the rope is CanCollide and Massless so the player can fling and be flung by the parts.

Since the parts are unanchored, you can’t set the rope to non-CanCollide without the rope falling through the floor, so you should use PhysicsServices to disable collisions between players and the rope with Collision Filtering

1 Like

Thank you for replying. I have taken your advice and I am not getting flung out of nowhere anymore. However, I still get pushed midair one direction when I jump while holding out the whip. I don’t know why.

1 Like


1 Like

Okay, so now in your recent video (and something I overlooked in the first video), the player is being dragged by the rope on equip, probably to where the rope was previously unequipped. And then when you get flung the rope is somehow pushing you.

This seems to be a pretty difficult physics problem that won’t be perfect without some massive overhaul that I don’t really know enough about to help you with, but I have one last idea on how to make it work better.

In your Equipped function, you essentially use a while wait() do loop, which is something that I would strongly advise against in anything other than a prototype. You can use RunService to avoid these types of loops. I usually use Heartbeat because its more consistent and I’m more comfortable using, but it might be beneficial for you to use RenderStepped or Stepped instead as they work slightly differently.

Here’s how I think your code could be better structured:

local RunService = game:GetService("RunService") -- get RunService
local connection -- hold the RunService connection

    local function drawRope()
        -- put your code for positioning the rope here
    drawRope() -- draw the rope instantly so you don't need to wait for next frame. Might help with the pulling
    connection = RunService.Heartbeat:Connect(function(drawRope) -- every frame, draw the rope

    if connection then

Did you ever figure out why the rope pushes you when you jump? I still can’t figure that out with my single segment rope.