Ragdoll not working when applied to alive characters

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    a ragdoll function that works on death and when alive

  2. What is the issue? Include screenshots / videos if possible!
    the ragdoll works perfectly when applied dead, but when alive the character just floats and slides

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    setting humanoid state to dead and ragdoll but nothing worked

local function ragdoll(npc,normal,power, backtonormal)
	local r = Instance.new("StringValue", npc)
	r.Name = "ragdoll"
	local KnockBack = Instance.new("BodyVelocity")
	KnockBack.Parent = npc:FindFirstChild("HumanoidRootPart")
	KnockBack.MaxForce = Vector3.new(80000,80000,80000)
	KnockBack.Velocity = Vector3.new(normal.X,0,normal.Z) * power
	local Humanoid : Humanoid = npc.Humanoid
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
	for index,joint : Motor6D in pairs(npc:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local o = Instance.new("ObjectValue")
			o.Name = "joint"
			o.Value = joint
			o.Parent = socket
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = joint.C0
			a2.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint.Enabled = false
		end
	end
	game:GetService("Debris"):AddItem(KnockBack, .2)
	if backtonormal then
		task.delay(backtonormal, function()
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			for index,socket in pairs(npc:GetDescendants()) do
				if socket:IsA("BallSocketConstraint") then
					socket.joint.Value.Enabled = true
					socket:Destroy()
				end
			end
		end)
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Try creating a clone and using that clone for the ragdoll, and if you were to disable the ragdoll delete the clone and restore the character.

Make sure Character.Archivable is true, so you can use the method Character:Clone() to create the clone.

I wouldnt recommend you using the same clone, so, like, when it activates it sets the characters parent to nil and creates a new ragdoll clone, and then when it deactivates it will set the characters parent back to workspace and destroy the clone, since a new one can be made.

Also, i think you will have to change the Player.Character property and the camera subject of the local camera, for that i think you could use a remote event to send a signal to the player that has the character that changes the camera subject.

after some researched I found out setting platformstand to true fixed the floating problem (platformstand being set to true will make the humanoid act dead and thats exactly what I want)

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