How to make character fall down when ragdolled

So currently I have this ragdoll module script right here in startercharacterscripts:

local module = {}
local Humanoid = script.Parent:WaitForChild("Humanoid")


Humanoid.BreakJointsOnDeath = false

function module:Ragdoll()
	for index,joint in pairs(script.Parent:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			print(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
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
			Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
			Humanoid.WalkSpeed = 0
		end
	end
end

function module:Unragdoll()
	for index,joint in pairs(script.Parent:GetDescendants()) do
		if joint:IsA("Motor6D") then
			if joint.Parent:FindFirstChild("Attachment") and joint.Parent:FindFirstChild("Attachment").Name == "Attachment" then
				joint.Parent:FindFirstChild("Attachment"):Destroy()
				if joint.Parent:FindFirstChildOfClass("BallSocketConstraint") then
					joint.Parent:FindFirstChildOfClass("BallSocketConstraint"):Destroy()
					if joint.Enabled == false then joint.Enabled = true end
					Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
					Humanoid.WalkSpeed = 16
				end				
			end
		end
	end
end

return module

And when I reset, the ragdoll works and I fall down. But when I call the Ragdoll function in a script when the player joins, they get ragdolled but doesn’t fall down, so how can I fix this?
(what I mean when they get ragdolled upon joining like in a game you hit someone and they get ragdolled for a couple of seconds)
Script:

wait(2)

local module = require(script.Parent.Ragdoll)

module.Ragdoll()

You’ll want to use LinearVelocity to make the player fall over. You do this, by moving the character just a bit ahead so their body can trip on itself.

Can you show me how I would script that?

No I can not, you should try inserting the LinearVelocity into a player and see how it works.

I can however, link you to a different Ragdoll System that has this system implemented I believe.

This doesn’t solve my problem but thanks!

I suggest using the ApplyImpulse() function.
This will ‘push’ the character using the velocity that you enter in the function, letting the physics slow down the movement unlike LinearVelocity, which is a constant.

ApplyImpulse() will push the player in their center of mass, which should be enough to nudge the player over before they fall. Make sure that you give the direction of the force using the character’s LookVector.


Example:

local force = 100 --//Change this value to find a good balance

BasePart:ApplyImpulse(character.HumanoidRootPart.CFrame.LookVector * force)
1 Like

Try putting the ragdoll function inside of a CharacterAdded so it runs only when the character has fully loaded also make sure humanoid root part is not anchored.