I am here with an issue that I can’t seem to figure out, and research on the topic has brought me to unanswered forums and no solutions. So This is my last resort. Sorry if this has already been answered.
I recently figured out how to make an unpolished version of a toggleable ragdoll script, but everything works except for the changing of the humanoid state type.
Below is my code that changes the state of the humanoid, and disables the motor6Ds:
Activated.Changed:Connect(function()
if Activated.Value == true then
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics) -- Here is what it's not doing
Character.HumanoidRootPart.RootJoint.Enabled = false
Character.Torso["Left Hip"].Enabled = false
Character.Torso["Right Hip"].Enabled = false
Character.Torso["Right Shoulder"].Enabled = false
Character.Torso["Left Shoulder"].Enabled = false
Character.Torso.Neck.Enabled = false
elseif Activated.Value == false then
Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
Character.HumanoidRootPart.RootJoint.Enabled = true
Character.Torso["Left Hip"].Enabled = true
Character.Torso["Right Hip"].Enabled = true
Character.Torso["Right Shoulder"].Enabled = true
Character.Torso["Left Shoulder"].Enabled = true
Character.Torso.Neck.Enabled = true
end
end)
When I first made it, it was client sided and it worked well, but I switched it over to server sided and the changing of the state type just stopped working.
I’ve tried using other state types and it still will not change the state. Is it just a bug or am I doing something wrong?
You might need to define the Character if you’re doing it in a server sided viewpoint, cause LocalScripts can easily find the Player & Character while you gotta define the character/player in many different ways, try this maybe in line 1?
I should’ve mentioned this isn’t my entire script, there is a bunch of code above it but it doesn’t matter because all of it works perfectly, I defined character as the players character above in a variable. This is a server script inside the starter character.
Try printing states throughout the code execution using Humanoid:GetState().
Because I don’t know how exactly your script works, you should do some testing. Most likely ragdoll’s state will be automatically set to Running (because moving is present), like in the example below, which was answered recently. To make the ragdoll fall, it was enough to just change the state to Physics at the end of the code, no matter it immediately changing back to previous one.
I will definitely try this, but I did find a solution where, it works on the client side but not the server, so I had a local script that changes it as the value changes and it worked perfectly fine. Thank you for your help!