Issues With Ball In Socket Constraint

Hello! I’m currently working on a ROBLOX Basketball game and I have made a system where you can hang on the hoops’ rim after dunking the ball.

The system works by using a hinge constraint to pull the rim down and a ball in socket constraint for the character to attach to multiple attachments placed onto the rim. It works fine for the first 2-3 times, but after that it tends to glitch out with the rim’s net. There are also times where the rim or character flat out disappear as shown in the clip below. There is also another issue where the character doesn’t keep it’s physics as listed in the ball in socket constraint’s description.

I am unsure on whether this is a physics issue or something related to the basketball or character collision with the basketball net.

This is the current code for the rim hanging function that I have created.

function Operator:RimHang(Player, HandednessType, Character, Rim, RimController)
	local Root = Character.HumanoidRootPart
	
	-- Constraint
	local BISConst = Instance.new("BallSocketConstraint")
	BISConst.Name = "RimHang"
	BISConst.LimitsEnabled = true
	BISConst.Restitution = 0
	BISConst.UpperAngle = 75

	-- Attachment
	local RootAtt = Instance.new("Attachment", Root)
	RootAtt.Visible = true
	RootAtt.Name = "RootAtt"
	RootAtt.Orientation = Vector3.new(0, 90, 0)
	RootAtt.CFrame = RootAtt.CFrame * CFrame.new(1.5,2,0)
	
	-- Animation
	local RHAnimation = Animations:GetAnimation(Player,HandednessType.."RimHang")
	RHAnimation:Play(.25)
	RHAnimation:AdjustSpeed(0)

	--
	Character.PrimaryPart.Massless = true
	local ClosestAtt = GetClosestAttachment(Character.HumanoidRootPart, Rim)
	print(ClosestAtt)
	BISConst.Attachment0 = Root.RootAtt
	BISConst.Attachment1 = ClosestAtt
	BISConst.Parent = Rim

	-- Rim
	RimController.TargetAngle = -15
	
	-- Reset
	task.wait(Operator.Hangtime/1.5)
	Character.PrimaryPart.Massless = false
	BISConst:Destroy()
	RootAtt:Destroy()
	task.delay(Operator.Hangtime/5, function()
		if RHAnimation.IsPlaying then
			RHAnimation:Stop(.25)
		end
		RimController.TargetAngle = 0
	end)

end

Turns out I still had bodygyro and velocity in the character causing it to break.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.