How do I make a ragdoll - standing transition smoother?

I am reworking a ragdoll thingamabob I made for myself - with an implemented getting up animation but here’s the thing:


It’s not quite functioning how I wish. For it to work - the player must have ragdolled while standing. How do I make it play seamlessly (and without colliding with the ground and stuff)?

Code:

function rgModule:Unragdoll(character: Model)
	local hrp = character:FindFirstChild("HumanoidRootPart")
	local hum = character:FindFirstChild("Humanoid")
	local plr = game:GetService("Players"):GetPlayerFromCharacter(character)
	-- ////////////////////////////////////////////////////////////////////////// --
	if character == nil then error("Character was not defined in function <Unragdoll>. Double-check your code!", 2) return end
	for i,socket in pairs(character:GetDescendants()) do
		if socket:IsA("BallSocketConstraint") then
			socket:Destroy()
			for i,attachment in pairs(character:GetDescendants()) do
				if attachment:IsA("Attachment") and attachment.Name == "RagdollAttachment" then
					attachment:Destroy()
				end
			end
			for i,joint in pairs(character:GetDescendants()) do
				if joint:IsA("Motor6D") then
					joint.Enabled = true
				end
			end
		end
	end
	print("Unragdolled!")
	event:FireClient(plr, false)
	
	local animID = "rbxassetid://110657831082635"
	local animator = hum:FindFirstChild("Animator")
	local animation = Instance.new("Animation")
	animation.AnimationId = animID
	local animationTrack = animator:LoadAnimation(animation)
	animationTrack:Play(0.3)
end
2 Likes

Maybe set the humanoid state to Enum.HumanoidStateType.Running to prevent the character from glitching inside the floor?

have the client set their HumanoidState to GettingUp to prevent that little fling/flip on get up

I do that already. A script on the client side handles it.

I could try that actually. Hang on.

Nope, now instead of a small fling, you do several back flips as if you were a lego character thrown by a 7 year old child.

1 Like

You could anchor the humanoidrootpart once the animation starts to play. This would make the character stay in place for the animation to play, then ofc unanchor it once it finsihes

I have tried that, however, due to the nature of ragdolling, the player ends up in abnormal angles or in the floor.

what state do you set the client to when ragdoll begins?

Physics, once unragdolled I set it to GettingUp

i remember i had this issue, i remember disabling a bunch of humanoid states

hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,true)
hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
hum:ChangeState(Enum.HumanoidStateType.Ragdoll)

this is what i used to ragdoll, and on get up i’d use this

hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,false)
hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
hum:ChangeState(Enum.HumanoidStateType.GettingUp)

Yeah, no. Didn’t work. yeeowch

all i can recommend is disabling more HumanoidStates :sweat_smile:

Make a LocalScript in StarterCharacterScripts and paste the following:

local Humanoid = script.Parent:WaitForChild("Humanoid")

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)

I believe this will stop the flinging all over the place. Just make sure these values are always like this.