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!