BallJoinConstraint won't create?

This function (the bottom one, won’t work), no errors

local V3_ZERO = Vector3.new();
local V3_UP = Vector3.new(0, 1, 0);
local V3_DOWN = Vector3.new(0, -1, 0);
local V3_RIGHT = Vector3.new(1, 0, 0);
local V3_LEFT = Vector3.new(-1, 0, 0);
local R15_ADDITIONAL_ATTACHMENTS = { { "UpperTorso", "RightShoulderRagdollAttachment", CFrame.fromMatrix(V3_ZERO, V3_RIGHT, V3_UP), "RightShoulderRigAttachment" }, { "RightUpperArm", "RightShoulderRagdollAttachment", CFrame.fromMatrix(V3_ZERO, V3_DOWN, V3_RIGHT), "RightShoulderRigAttachment" }, { "UpperTorso", "LeftShoulderRagdollAttachment", CFrame.fromMatrix(V3_ZERO, V3_LEFT, V3_UP), "LeftShoulderRigAttachment" }, { "LeftUpperArm", "LeftShoulderRagdollAttachment", CFrame.fromMatrix(V3_ZERO, V3_DOWN, V3_LEFT), "LeftShoulderRigAttachment" } };
local R15_RAGDOLL_RIG = { { "UpperTorso", "Head", "NeckRigAttachment", HEAD_LIMITS }, { "LowerTorso", "UpperTorso", "WaistRigAttachment", WAIST_LIMITS }, { "UpperTorso", "LeftUpperArm", "LeftShoulderRagdollAttachment", SHOULDER_LIMITS }, { "LeftUpperArm", "LeftLowerArm", "LeftElbowRigAttachment", ELBOW_LIMITS }, { "LeftLowerArm", "LeftHand", "LeftWristRigAttachment", WRIST_LIMITS }, { "UpperTorso", "RightUpperArm", "RightShoulderRagdollAttachment", SHOULDER_LIMITS }, { "RightUpperArm", "RightLowerArm", "RightElbowRigAttachment", ELBOW_LIMITS }, { "RightLowerArm", "RightHand", "RightWristRigAttachment", WRIST_LIMITS }, { "LowerTorso", "LeftUpperLeg", "LeftHipRigAttachment", HIP_LIMITS }, { "LeftUpperLeg", "LeftLowerLeg", "LeftKneeRigAttachment", KNEE_LIMITS }, { "LeftLowerLeg", "LeftFoot", "LeftAnkleRigAttachment", ANKLE_LIMITS }, { "LowerTorso", "RightUpperLeg", "RightHipRigAttachment", HIP_LIMITS }, { "RightUpperLeg", "RightLowerLeg", "RightKneeRigAttachment", KNEE_LIMITS }, { "RightLowerLeg", "RightFoot", "RightAnkleRigAttachment", ANKLE_LIMITS } };
local R15_NO_COLLIDES = { { "LowerTorso", "LeftUpperArm" }, { "LeftUpperArm", "LeftHand" }, { "LowerTorso", "RightUpperArm" }, { "RightUpperArm", "RightHand" }, { "LeftUpperLeg", "RightUpperLeg" }, { "UpperTorso", "RightUpperLeg" }, { "RightUpperLeg", "RightFoot" }, { "UpperTorso", "LeftUpperLeg" }, { "LeftUpperLeg", "LeftFoot" }, { "UpperTorso", "LeftLowerLeg" }, { "UpperTorso", "RightLowerLeg" }, { "LowerTorso", "LeftLowerLeg" }, { "LowerTorso", "RightLowerLeg" }, { "UpperTorso", "LeftLowerArm" }, { "UpperTorso", "RightLowerArm" }, { "Head", "LeftUpperArm" }, { "Head", "RightUpperArm" } };
local R15_MOTOR6DS = { { "Waist", "UpperTorso" }, { "Neck", "Head" }, { "LeftShoulder", "LeftUpperArm" }, { "LeftElbow", "LeftLowerArm" }, { "LeftWrist", "LeftHand" }, { "RightShoulder", "RightUpperArm" }, { "RightElbow", "RightLowerArm" }, { "RightWrist", "RightHand" }, { "LeftHip", "LeftUpperLeg" }, { "LeftKnee", "LeftLowerLeg" }, { "LeftAnkle", "LeftFoot" }, { "RightHip", "RightUpperLeg" }, { "RightKnee", "RightLowerLeg" }, { "RightAnkle", "RightFoot" } };
local R6_ADDITIONAL_ATTACHMENTS = { { "Head", "NeckAttachment", CFrame.new(0, -0.5, 0) }, { "Torso", "RightShoulderRagdollAttachment", CFrame.fromMatrix(Vector3.new(1, 0.5, 0), V3_RIGHT, V3_UP) }, { "Right Arm", "RightShoulderRagdollAttachment", CFrame.fromMatrix(Vector3.new(-0.5, 0.5, 0), V3_DOWN, V3_RIGHT) }, { "Torso", "LeftShoulderRagdollAttachment", CFrame.fromMatrix(Vector3.new(-1, 0.5, 0), V3_LEFT, V3_UP) }, { "Left Arm", "LeftShoulderRagdollAttachment", CFrame.fromMatrix(Vector3.new(0.5, 0.5, 0), V3_DOWN, V3_LEFT) }, { "Torso", "RightHipAttachment", CFrame.new(0.5, -1, 0) }, { "Right Leg", "RightHipAttachment", CFrame.new(0, 1, 0) }, { "Torso", "LeftHipAttachment", CFrame.new(-0.5, -1, 0) }, { "Left Leg", "LeftHipAttachment", CFrame.new(0, 1, 0) } };
local R6_RAGDOLL_RIG = { { "Torso", "Head", "NeckAttachment", R6_HEAD_LIMITS }, { "Torso", "Left Leg", "LeftHipAttachment", R6_HIP_LIMITS }, { "Torso", "Right Leg", "RightHipAttachment", R6_HIP_LIMITS }, { "Torso", "Left Arm", "LeftShoulderRagdollAttachment", R6_SHOULDER_LIMITS }, { "Torso", "Right Arm", "RightShoulderRagdollAttachment", R6_SHOULDER_LIMITS } };
local R6_NO_COLLIDES = { { "Left Leg", "Right Leg" }, { "Head", "Right Arm" }, { "Head", "Left Arm" } };
local R6_MOTOR6DS = { { "Neck", "Torso" }, { "Left Shoulder", "Torso" }, { "Right Shoulder", "Torso" }, { "Left Hip", "Torso" }, { "Right Hip", "Torso" } };
local BALL_SOCKET_NAME = "RagdollBallSocket";
local NO_COLLIDE_NAME = "RagdollNoCollision";
local function indexParts(model)
	local parts = {};
	local _0 = model:GetChildren();
	for _1 = 1, #_0 do
		local child = _0[_1];
		if child:IsA("BasePart") then
			local Name = child.Name;
			if not (parts[Name]) then
				parts[Name] = child;
			end;
		end;
	end;
	return parts;
end;
local function createRigJoints(parts, rig)
	for _0 = 1, #rig do
		local params = rig[_0];
		local part0Name = params[1];
		local part1Name = params[2];
		local attachmentName = params[3];
		local limits = params[4];
		local part0 = parts[part0Name];
		local part1 = parts[part1Name];
		if part0 and part1 then
			local a0 = part0:FindFirstChild(attachmentName);
			local a1 = part1:FindFirstChild(attachmentName);
			if a0 and a1 and (a0:IsA("Attachment")) and (a1:IsA("Attachment")) then
				local constraint = part1:FindFirstChild(BALL_SOCKET_NAME);
				if not (constraint) then
					constraint = Instance.new("BallSocketConstraint");
					constraint.Name = BALL_SOCKET_NAME;
				end;
				limits = limits;
				constraint.Attachment0 = a0;
				constraint.Attachment1 = a1;
				constraint.LimitsEnabled = true;
				constraint.UpperAngle = limits.UpperAngle;
				constraint.TwistLimitsEnabled = true;
				constraint.TwistLowerAngle = limits.TwistLowerAngle;
				constraint.TwistUpperAngle = limits.TwistUpperAngle;
				local gravityScale = Workspace.Gravity / REFERENCE_GRAVITY;
				local referenceMass = limits.ReferenceMass;
				local _1 = referenceMass;
				if _1 ~= 0 and _1 == _1 and _1 then
					_1 = part1:GetMass() / referenceMass;
				end;
				local _2 = _1;
				local massScale = (_2 ~= 0 and _2 == _2 and _2) or 1;
			end;
		end;
	end;
end;
2 Likes

I don’t see the parent of the ball socket constraint being set anywhere, which means it isn’t added to the physical world or anywhere it would stay. Instead, it will be garbagecollected.

1 Like

Oh wait this isn’t the full one? How did I miss that? In the full one it is parenteed