Why doesnt my ragdoll drop the characters?

hello there! I just figured out how to set players into ragdoll but I ran into a problem when implementing it into a script. So basically the player types the spell (ad somnum) in the chat and presses on a player which causes them to go into ragdoll for like 5 seconds. The player chatting and clicking on a player is handled in a local script and the rest is handled in a server script. The script works fine but the ragdoll only makes them wiggle but they dont drop.

here’s an example of what happens:
https://gyazo.com/2a8adc5f8021e531415e5619ed7dd00e

here’s the server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BurnEvent = ReplicatedStorage.Remotes:WaitForChild("Sleep")

BurnEvent.OnServerEvent:Connect(function(player, target)
	
	local victim = target.Parent:FindFirstChild("Humanoid")
	local victimCharacter = target.Parent
	
	if victim then

		victim.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
		victim.Parent.Humanoid.JumpPower = 0

		for _, v in pairs(victim.Parent:GetDescendants()) do
			if v:IsA("BasePart") and v.Name == "Head" or v.Name == "LowerTorso" then
				local weld = Instance.new("Weld")
				weld.Part0 = victim.Parent.HumanoidRootPart
				weld.Part1 = v
				weld.C0 = victim.Parent.HumanoidRootPart.CFrame:Inverse()
				weld.C1 = v.CFrame:Inverse()
				weld.Parent = victim.Parent.HumanoidRootPart
			end


			if v:IsA("Motor6D") then
				local attachment1 = Instance.new("Attachment")
				local attachment0 = Instance.new("Attachment")

				attachment1.Name = "Attachment1"
				attachment0.Name = "Attachment0"

				attachment0.CFrame = v.C0
				attachment1.CFrame = v.C1
				attachment0.Parent = v.Part0
				attachment1.Parent = v.Part1

				local constraint = Instance.new("BallSocketConstraint")

				constraint.Attachment1 = attachment1
				constraint.Attachment0 = attachment0
				constraint.Parent = v.Part0
				
				v:Destroy()
				
			end
		end				
		
		local bv = Instance.new("BodyVelocity")
		bv.Velocity = target.Parent.HumanoidRootPart.CFrame.LookVector * -2
		bv.Parent = target
		wait(0.1)
		bv:Destroy()

		for count = 1,10 do
			wait()
			player.Character.Magic.Value -= 7.5
		end
		
		wait(50)

		target.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
		target.Parent.Humanoid.JumpPower = 50

		for _, v in pairs(target.Parent:GetDescendants()) do
			if v.Name == "Attachment1" or v.Name == "Attachment0" or v:IsA("Weld") or v:IsA("BallSocketConstraint") then
				v:Destroy()
			end
		end
		target.Parent.Humanoid:BuildRigFromAttachments()
	end
end)
2 Likes

Make sure the character that is being ragdolled has the humanoidrootpart unanchored

it’s unanchored, but it still happens

Maybe other parts are anchored?

nope. I added a neck to the characters, could that mess things up?

Um I’m not sure but I don’t think so

hmm, let me try removing it and see if it helps

Maybe try it on a regular rig and see what happens? With hrp unanchored

1 Like

This is kinda irrelevant but you do victim.Parent.Humanoid (which is basically the same thing as victim)

yeah I’ve noticed, this was written at like 1am-

They just began shaking weirdly

I believe the issue is here, I find that changing states is unreliable because humanoid state types are controlled from the client and that causes a lot of issues as character are also client controlled.

I find that it is more reliable to just turn on platform stand or seated to disable the humanoid from exerting physics.

victim.Parent.Humanoid.PlatformStand = true
2 Likes

so I should just make them platform stand and then run the ragdoll?

sorry to bother you but I tried what you suggested and it worked, but the character’s body parts were in the floor and when I tried making it collidable the character didn’t ragdoll. any chance you might know why or how to solve it?

here’s a video if it happening:
https://gyazo.com/51c2588485ed922c1f004521a99e4963

:ChangeState(Enum.HumanoidStateType.Ragdoll)

Yep like @Limited_Unique said but more detail.

Might be better to follow this if you get frustrated with state types not working, cloning and creating fake limbs.

1 Like