Ragdoll flying issue

I’m trying to create a ragdoll function. It works, but it shoots the character into the air.

Server script:

local d = char:GetDescendants()
for i=1,#d do
	local desc = d[i]
	if desc:IsA("Motor6D") then
		local socket = Instance.new("BallSocketConstraint")
		local part0 = desc.Part0
		local joint_name = desc.Name
		local attachment0 = desc.Parent:FindFirstChild(joint_name.."Attachment") or desc.Parent:FindFirstChild(joint_name.."RigAttachment")
		local attachment1 = part0:FindFirstChild(joint_name.."Attachment") or part0:FindFirstChild(joint_name.."RigAttachment")
		if attachment0 and attachment1 then
			socket.Attachment0, socket.Attachment1 = attachment0, attachment1
			socket.Parent = desc.Parent
			desc:Destroy()
		end	
	end
end

Any help would be appreciated. :slightly_smiling_face:

3 Likes

Interesting. I’ve used a similar script and it doesn’t do that. Could you show a video of what happens?

1 Like
1 Like

Kinda funny to be honest, I think you should keep it that way :laughing:

2 Likes

We can’t have it like that, we need it to be a normal ragdoll.

1 Like

Try putting a body velocity in the humanoid root part that forces it down.

1 Like

That won’t work either because people will be able to pick people who are ragdolled up.

1 Like

Disable the velocity when they are picked up?

1 Like

Good point lol. (30characters)

3 Likes

Hmm. I think that this happens because constraint is trying to snap 2 attachments together, and one of them is somewhere up in the air. You should make attachments visible and see if there’s any attachment in the air.

2 Likes

I just checked. No, there are no attachments are in the air.

1 Like

Oh. Imo this should be moved to #platform-feedback:engine-bugs, because there’s no reason for it to fly.
Also, does the ragdoll stop at some moment?

1 Like

Nope, it just keeps on flying. And I feel like this is still my error.

2 Likes

Let me see the full behaviour of this ragdoll. This might take time.

2 Likes

I have tried this in baseplate, everything works fine and character ragdolls as he should. I’ve noticed that this scrpt doesn’t work with R6.
I think that this affects only your game. Try to find anything that interacts with character in any way.

1 Like

That doesn’t make sense, everything was normal without the ragdoll and it only flings you into the air when you ragdoll.

2 Likes

I think that the tool is the cause for this. Try to save your tool to a file, open a baseplate, insert an R15 rig (plugins tab → rig builder), insert your tool into starter pack and see if it still flies.

2 Likes

I inserted the ragdoll script in a random baseplate without the weapon and called it on the character when the player is added and it still flies.

Here are both scripts if needed.

Server:

game.ReplicatedStorage.Remotes.Ragdoll.OnServerEvent:Connect(function(p,char)
	local d = char:GetDescendants()
	for i=1,#d do
		local desc = d[i]
		if desc:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local part0 = desc.Part0
			local joint_name = desc.Name
			local attachment0 = desc.Parent:FindFirstChild(joint_name.."Attachment") or desc.Parent:FindFirstChild(joint_name.."RigAttachment")
			local attachment1 = part0:FindFirstChild(joint_name.."Attachment") or part0:FindFirstChild(joint_name.."RigAttachment")
			if attachment0 and attachment1 then
				socket.Attachment0, socket.Attachment1 = attachment0, attachment1
				socket.Parent = desc.Parent
				desc:Destroy()
			end	
			local new = Instance.new("BodyVelocity")
			new.Velocity = Vector3.new(0,-100,0)
			new.Parent = char.HumanoidRootPart
		end
	end
end)

Client:

local p = game.Players.LocalPlayer
game.ReplicatedStorage.Remotes.Ragdoll:FireServer(p.Character)
game.ReplicatedStorage.Remotes.Killed.OnClientEvent:Connect(function(player)
    game.SoundService.SoundEffects.Kill:Play()
    game.ReplicatedStorage.Remotes.Ragdoll:FireServer(player.Character)
end)
3 Likes

Bruh. It also happened to me. Thirty characters.

1 Like

You’re getting launched into the air as well?

2 Likes