Problems with humanoid states

when using humanoid states to dummies they get changed to Running, even when disabled completely and this breaks ragdolls


my current ragdoll changes state to fallingdown or physics which works perfect for players but not for dummies as shown here

(printed their humanoid state and it was Running)

Make sure when you change humanoid states on the server that the dummies network owner is also server (nil). Only the network owner can change humanoid states.

Hope this helps! :smiley:

1 Like

I already am
its a roblox related bug probably

I think a very important information is missing, THEY DO WORK FOR A SMALL AMOUNT OF TIME after that every other ragdolled dummy completely breaks and the ragdoll stops working for dummies

maybe this will help

local function enableRagdoll(npc)
    local humanoid = npc:FindFirstChildWhichIsA("Humanoid")
    if humanoid then
        -- Disable default humanoid states that may interfere with the ragdoll
        humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
        humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
        humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true)
        
        -- Set the humanoid state to Physics to enable ragdoll behavior
        humanoid:ChangeState(Enum.HumanoidStateType.Physics)
    end
end
  • set the humanoid state to “Physics” when enabling the ragdoll effect. This will ensure that the humanoid behaves according to the physics simulation rather than the built-in humanoid state machine.

I doubt it is a bug and is just a matter of correctly assigning network owners. Here is a test setup I used with some ragdoll module I happened to have around :smiley:

local Ragdoll = require(script.RagdollRigging)

local Rig = workspace.Rig
local Humanoid = Rig:FindFirstChildOfClass("Humanoid")
Ragdoll.createRagdollJoints(Rig, Enum.HumanoidRigType.R15)
Ragdoll.toggleMotors(Rig, Enum.HumanoidRigType.R15, false)

Rig.PrimaryPart:SetNetworkOwner(nil)
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)

With this, the dummy will work as intended:
kuva
If I slightly adjust the code to the following:

local Ragdoll = require(script.RagdollRigging)

local Rig = workspace.Rig
local Humanoid = Rig:FindFirstChildOfClass("Humanoid")
Ragdoll.createRagdollJoints(Rig, Enum.HumanoidRigType.R15)
Ragdoll.toggleMotors(Rig, Enum.HumanoidRigType.R15, false)

game.Players.PlayerAdded:Connect(function(Player: Player)
	Player.CharacterAdded:Connect(function(Character)
		Rig.PrimaryPart:SetNetworkOwner(Player) -- Network owner is player
		Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	end)
end)

Then I get results that you were getting
kuva
So I do not think its a bug. If the current script running isn’t the network owner of the humanoid then it is unable to change the humanoid state. Meaning in this latest case, if I added a localscript to change the Dummy’s humanoid state to Physics you can see it topples down

-- Localscript
workspace.Rig.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)

kuva
Hopefully this gives you better insight on what might be going on! :smiley: If you have any additionnal questions, do let me know!

Your initial setup involves creating ragdoll joints for a model (presumably a character rig) and then toggling motors off. By setting the network owner of the rig’s primary part to nil, you essentially tell Roblox’s physics engine that the server should handle the physics simulation for this rig. This works as intended because the server has the authority to change the humanoid state to physics, causing the rig to behave as a ragdoll.

local Ragdoll = require(script.RagdollRigging)

local Rig = workspace.Rig
local Humanoid = Rig:FindFirstChildOfClass("Humanoid")
Ragdoll.createRagdollJoints(Rig, Enum.HumanoidRigType.R15)
Ragdoll.toggleMotors(Rig, Enum.HumanoidRigType.R15, false)

Rig.PrimaryPart:SetNetworkOwner(nil)
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)

Adjusted Code with Player Network Ownership

In the adjusted code, you’re setting the network owner of the rig’s primary part to a player when they join the game and their character is added. This means that the client (the player’s game) is now responsible for the physics simulation of the rig. However, since the script attempting to change the humanoid state is likely running on the server, it encounters issues because the server no longer has authority over the physics simulation of that rig.

local Ragdoll = require(script.RagdollRigging)

local Rig = workspace.Rig
local Humanoid = Rig:FindFirstChildOfClass("Humanoid")
Ragdoll.createRagdollJoints(Rig, Enum.HumanoidRigType.R15)
Ragdoll.toggleMotors(Rig, Enum.HumanoidRigType.R15, false)

game.Players.PlayerAdded:Connect(function(Player: Player)
	Player.CharacterAdded:Connect(function(Character)
		Rig.PrimaryPart:SetNetworkOwner(Player) -- Network owner is player
		Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	end)
end)

Solution and Best Practices

To ensure consistent behavior across different network ownership scenarios, it’s important to manage state changes (like setting the humanoid state to physics) in a context that matches the network owner. If the network owner is a client, then changes to physics states should also be initiated from the client side, for example, using a LocalScript.

This approach is what you’ve discovered with the LocalScript solution for changing the humanoid state to Physics. It works because the LocalScript executes in the context of the client that owns the network ownership of the rig, ensuring that the command to change the state is authorized.

-- Localscript
workspace.Rig.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)

Thank you for organizing my post into something more readable :smiley: Like I mentioned in my post and you in this post, I do believe the fact that the humanoid state not changing to Physics isn’t a bug but an intended side effect of changing network ownership. This is something that the OP should double check

1 Like

yeah I already did that and somehow the state became running as I said.

the ragdoll does work, and I an pretty sure the dunmies network owner is already nil and I am doing it in the server, after some ragdolling and unragdolling it stops working

I recommend when dummies have their ragdolling stop working, you print out their current NetworkOwner to see if it is indeed nil. By default Network Ownership changes depending on the players who are nearby, so if you are closest then you become the network owner.

oh, that might be the reason thanks! will try that right now.

Let us know how that goes :smiley: If you want dummies to be handled by server then make sure to explicitly make them by using PrimaryPart:SetNetworkOwner(nil)

1 Like


idk why I didnt know this before. Thanks for helping me fix this bug!

1 Like

No worries, glad we managed to figure it out! :smiley: