How can I improve my ragdoll script?

My ragdoll script is kinda weird, and I want to know how can I fix it, or it’s fine? Also, sometimes the player stands and they are still ragdolled.

Ragdolls.Ragdoll = function(char, player)
	if player ~= nil then
		game.ReplicatedStorage.Events.Extras.RagdollEvent:FireClient(player, "Ragdoll")
	end
	char.Humanoid.JumpPower = 0 
	char.Humanoid.WalkSpeed = 0
	char.Humanoid.BreakJointsOnDeath = false
	for _, v in pairs(char:GetDescendants()) do
		if v:IsA("Motor6D") then
			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.Name = "SAttachment0"
			a1.Name = "SAttachment1"
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			a0.Parent = v.Part0
			a1.Parent = v.Part1

			v.Part0.CanCollide = true
			v.Part1.CanCollide = true

			local b = Instance.new("BallSocketConstraint")
			b.Attachment0 = a0
			b.Attachment1 = a1
			b.Parent = v.Part0

			v.Enabled = false
		end
	end
end

This should be in “Creations feedback”.

But, I also need to know how to make the player fall down too.

Could you show a video of it so we can see what changes might need to be made to make it look like how you want

1 Like

Use BodyVelocity to push it down using the Y axis.

Nevermind, I realised I have another BodyVelocity.

The ragdoll script does not seem to have an option for disabling. You might want this to be a feature. For example, if a player falls down but doesn’t die, you can make the player ragdoll for 5 seconds before getting up again.

This is maybe for this game hes making:

That game has that feature.

Yes thats the game

bbbbbbbbbbbbbbbbb

In that case, with fighting games you should make the player always get up properly (if they get up) after being ragdolled. Sometimes, if mouselock is enabled, the player would spin out of existence and into the void if they don’t get up properly.

That kind of worked, since most players would be standing and still be ragdolled, thank you and merry christmas!

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