Ball and socket constraints not connecting?

I’m trying to create a rim hang for my basketball game. I want to have the player hang by their hands from the rim using a ball and socket constraint in both hands. The attachments get positioned fine but one hand just… floats away. Heres a video (the green dots are the attachments)


You can see that the left hand connects with its rim attachment fine. The right hand however is far away and not even close.

Code for hanging them from the rim:
for i = 1,2 do
				local rightHand = (i == 1) and true or false
				local hand = rightHand and char:WaitForChild("RightHand") or char:WaitForChild("LeftHand")

				local constraint = Instance.new("BallSocketConstraint")  

				local direction = CFrame.lookAt(goalPos, Vector3.new(hand.Position.X, goalPos.Y - 0.35, hand.Position.Z)).LookVector * 1.35
				local a1, a2 = Instance.new("Attachment"), Instance.new("Attachment")

				a1.Parent = rim
				a2.Parent = hand
				a1.WorldPosition = goalPos + direction

				a1.Visible = true a2.Visible = true

				constraint.Attachment0 = a1
				constraint.Attachment1 = a2
				constraint.Parent = rim

				game.Debris:AddItem(a1, rimHangTime)
				game.Debris:AddItem(a2, rimHangTime)
				game.Debris:AddItem(constraint, rimHangTime)
end

Solutions I have tried:

  • Making the attachments at the exact same time rather than in a for loop.
  • Messing with all of the ball and socket constraint properties
  • Making the character collide with nothing at all using collision groups
  • Enabling platform stand during a rim hang
  • Not using a StarterCharacter (This gave me a different result where the right hand was much closer but still didn’t quite make it.)

None of the above worked.


I would love to find a solution for this since I have been stuck trying to fix it for the past 2 days now. Any help is appreciated!

What if you just use one centered constraint and make it look like both hands are attached? Perhaps the constraints are fighting one another?

1 Like

Thats what I am suspecting as well, however I would much rather figure out a possible way to keep them from fighting each other. Is there a property regarding how much it can rotate on one axis?

I asked two other devs who have made rim hanging and they said it is through 2 hands connected to the rim (just like my system).

Hrm. I know when I use constraints like this I got some wonky results at times due to client/server boundary issues. Perhaps your having a similar issue? For instance if I create the constraint on the client end, the server doesn’t see it and connecting only on the server the client wouldn’t replicate that connection.

This is all done on the server, I just tried setting the whole character’s network owner to nil but it seemed to not have made a difference. I’m going to try making them all at once one more time to see if this fixes it.

I have just done a bit of testing and I think it is because they are overlapping each other. When I generated the left hand first it made be hang by my right hand and the left flew away (The opposite of the video). If I do the right hand first I get the result from the video.