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)
@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.
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.