Ragdoll triggers Air floor material

For some reason, whenever the character is ragdolled, their floor material is air, even when they are clearly on the ground.
Video here:

External Media

Here is a snippet of code from the ragdoll module I use:

local function toggleCharacterRagdoll(character: Model, enable: boolean)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	assert(humanoid, character.Name .. " is not a Humanoid")

	humanoid:ChangeState(enable and Enum.HumanoidStateType.Physics or Enum.HumanoidStateType.GettingUp)
	humanoid.AutoRotate = not enable
	character.PrimaryPart.Massless = enable
	character:SetAttribute("Ragdolled", enable)

	for _, motor6D in ipairs(character:GetDescendants()) do
		if motor6D:IsA("Motor6D") and motor6D.Part1 ~= character.PrimaryPart and motor6D.Part0 ~= character.PrimaryPart then
			setRagdollMotor6D(motor6D, humanoid.RigType == Enum.HumanoidRigType.R15, enable)
		else
			local weldConstraint = character.PrimaryPart:FindFirstChildOfClass("WeldConstraint")
			if weldConstraint then
				weldConstraint.Enabled = enable
			end
			character.PrimaryPart.CanCollide = not enable
		end
	end

	(ReplicatedStorage:WaitForChild("RagdollEvent") :: RemoteEvent):FireAllClients(character, enable)
end

Help appreciated! Thank you!
(By the way I’m not sure if it is a problem with the dummy not having a client)

1 Like

bump cuz i still need help :sad:
charcharcharcharlimit

1 Like

Bump again, pls someone h elp meeeeeeeeee

1 Like

Unsure, but I believe it might have something to do with HumanoidStateType or the fact that the humanoid is not “standing” on any material.

Again, this requires testing of your own, and plus your video ngl should’ve posted it to a platform like YT or medal.

2 Likes

@WizulousThe2nd is right. I don’t think the humanoid detects the floor material when in physics. You could try and make a raycast to detect what the material is.

1 Like

Would I do a destination ray cast or a direction raycast?

1 Like

I think direction, I’m not sure what you mean, but I suppose direction.

1 Like

Could be that simply if you are walking, a raycast is being sent from the HRP (possibly). It faces downwards towards the legs. If it detects nothing, then the material is air.

it’s nothing to worry about.

1 Like

Make your own air detection meganism.

Try using raycast for example

1 Like

That wouldn’t work because if the character is ragdolled their legs face random directions

1 Like

I meant if I should ray cast between the hrp and the ground or just send it from the hrp

1 Like

direction is -Vector3.yAxis and cast a ray that direction

workspace:Raycast(hrp.Position, hrp.Position + Vector.yAxis)

im pretty sure direction is independent from the hrp’s rotation and position, but you should try it.

I think you should just send it from the hrp. You would detect it anyways.

I did this along with detecting if the result was the ground and it worked so thanks.

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