How do I make the limbs collide instead of it going through everything. CanCollide isnt working

the joint replacement function

local function replaceJoint(part0, part1, jointName, rigType)
		local motor = findMotorForJoint(part0, part1, jointName, rigType)
		if not motor then 
			warn("No motor found for joint: " .. jointName)
			return 
		end

		storedMotors[jointName] = {
			Part0 = motor.Part0,
			Part1 = motor.Part1,
			C0 = motor.C0,
			C1 = motor.C1,
		}

		local a0 = Instance.new("Attachment", part0)
		a0.Name = jointName .. "_A0"
		local a1 = Instance.new("Attachment", part1)
		a1.Name = jointName .. "_A1"

		a0.CFrame = motor.C0
		a1.CFrame = motor.C1

		local constraint = Instance.new("BallSocketConstraint")
		constraint.Attachment0 = a0
		constraint.Attachment1 = a1
		constraint.Parent = part0

		motor:Destroy()
		
		a0.Parent.CanCollide = true
		a1.Parent.CanCollide = true
end

video:

all help is appreciated :slight_smile:

1 Like

There is something else affecting the can collide property of your limbs. Joints/constraints will not effect cancollide.

2 Likes

what would have that effect on them?

check that the limbs are set to canncollide true in the workspace and ensure no other scripts are setting their cancollide property to false.

what about platform stand property? as far as i know it shouldnt affect it. i have no other scripts besides the fall damage and ragdoll.

your body parts don’t have can collide true in workspace.

manually checking the property to true in workspace works but through the script it doesnt work.

It doesn’t work in your script because your script doesn’t iterate through the bodyparts and set cancollide to true. it only sets the parent o the attachments to cancollide true.

I tried to loop through the character:

for k, part in ipairs(character:GetChildren()) do
	if part:IsA("BasePart") then
		part.CanCollide = true
	end
end

maybe im just too dumb to make this work lol :sob:

I’ll take a break and come back to this

Roblox humanoid characters have their limbs set to CanCollide = false every frame. This is intended behaviour, just how humanoids work.

I’m pretty sure, like 70% sure that if you set the Humanoid.StateType to Physics, it stops the engine from automatically overriding any properties you set, so setting CanCollide should work then. Haven’t touched the state in a while though so I honestly might’ve forgotten.

If that doesn’t work, you could always weld a part to each limb that acts as the collision piece.

1 Like

I don’t believe this to be true. I’m p sure the engine only sets hroot and a few other thinsg but not limbs

This is how it’s been for a good while actually.

I’m sure there’s a reasonable reason why, but man it’s quite annoying.

1 Like

thanks. i solved it. I defined a ragdolled bool and set it to false. then when ragdoll state is enabled it’s set to true. while it’s set to true, set cancollide to true.

not sure if this is the best way to do it. (runService possibly?)

Edit:
instead of using a while loop to constantly set it to true, I used RunService to do it more efficiently.

1 Like

Please do not spread false infotmation. The engine only sets head, torso parts and hroot to can collide true. Not limbs.

1 Like

It’s the case for limbs too. Peep the Roblox announcement below.

I was partially wrong, in that they changed it so that instead of having it set every frame, it’s set every state change. But doesn’t matter, humanoids still get their limb collisions reset automatically, causing the problem OP had.

Hence why setting the humanoid state to one that doesn’t automatically switch, like Physics, would fix this. Also why OP’s solution works, as setting collision on only after the state is changed to ragdoll won’t have it automatically negate.

nvm lol you’re right hahaha. some reason i thought we was talkking abt setting cancollide to true.

1 Like

OH lol, that’s for the root and torso, yeah :sob: no worries!

1 Like