Why does this happen

So recently, I was coding a ragdoll system for a game. I’m extremely confused mainly because of roblox’s hidden corescripts for humanoid I don’t get to see. I noticed whenever I jump before ragdolling that it for some odd reason does not set platformstand to the value I want. Another weird issue is that it sets the cancollide of all the limbs to false if I jump before. Does anyone know
what is happening?
here’s a video of the issue as well:

here’s my code:

local LeftLeg = script.Parent:WaitForChild("Left Leg")
local LeftArm = script.Parent:WaitForChild("Left Arm")
local RightArm = script.Parent:WaitForChild("Right Arm")
local RightLeg = script.Parent:WaitForChild("Right Leg")
local Head = script.Parent:WaitForChild("Head")
local Humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local Character = script.Parent



local function SetRagdoll(Value)
   Humanoid.AutoRotate = not Value
   Humanoid.PlatformStand = Value
   for _,Joint in pairs(Character:GetDescendants()) do
   	if Joint:IsA("Motor6D") and Joint.Parent.Parent == Character then
   		Joint.Enabled = not Value
   	end
   end
   Character.Data.Ragdoll.Value = Value
   task.wait(0.05)
   LeftArm.CanCollide = Value
   LeftLeg.CanCollide = Value
   RightArm.CanCollide = Value
   RightLeg.CanCollide = Value
   if not Value then
   	Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false) 
   	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
   else
   	Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true) 
   	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
   end
end```

Is this script a local script or a server script? If this is a server script, I think you need to run the humanoid changes on the client, like when you change the humanoid state and platform stand values, otherwise weird bugs like what you are experiencing happens. I’m not fully sure though, just a guess.

I’ve tried both, it’s harder to do on client, but it still happens

I would then recommend looking at some other ragdoll systems on the devforum, and seeing how those are made. You can find out a lot of useful techniques and how to fix bugs by looking at how other people do this. This is also how I fixed my ragdoll system I made, which had similar bugs.

Just search “ragdoll” in community resources, and there are plenty of ragdoll systems you can look at.

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