How do I prevent the player from standing up and being ragdolled at the same time?

Basically, I have a knockback system, right? I make the player ragdoll and they get knockbacked. I want it so that they don’t float like a fish and stand at the same time, but make them go on the ground while being ragdolled.

1 Like

Can you paste your knockback script so we can fix it?

1 Like
		local targetedplayerinstance = game:GetService("Players"):GetPlayerFromCharacter(targetedplayer)
		local velocity = Instance.new("BodyVelocity",targetedplayer.HumanoidRootPart)
		velocity.MaxForce = Vector3.new(2,2,2) * math.huge
		local dir = (targetedplayer.HumanoidRootPart.CFrame.Position - player.Character.HumanoidRootPart.Position).Unit
		velocity.Velocity = Vector3.new(playerHumanoidRP.CFrame.LookVector.X * script.Parent.GloveStatsConfig.Power.Value, 0.7, playerHumanoidRP.CFrame.LookVector.Z * script.Parent.GloveStatsConfig.Power.Value) 
		local rot = Instance.new("BodyAngularVelocity",targetedplayer.HumanoidRootPart)
		rot.AngularVelocity = Vector3.new(1,2,1) * math.pi * 5
		rot.MaxTorque = Vector3.new(2,5,2) * math.huge
		rot.P = 5000

When knocked back, is the humanoidstatetype set to FallingDown or Ragdoll? This hopefully should prevent the player from having floppy limbs and walking at the same time.

HumanoidStateType | Roblox Creator Documentation

You want to set their humanoid’s PlatformStand property to true, and make a disabled script in StarterCharacterScripts that has a RunService method (any method, doesn’t matter) that continuously makes their character’s limbs’ CanCollide go to true (if you set it once, it just gets set back to false for some reason). If they die when this happens, then put the humanoid’s property RequiresNeck to false until they get back up from the rag doll. The reason why I know so much about rag dolling is because I’ve experimented against a lot of Roblox’s internal stuff and this is what I’ve come up with.

1 Like

It’s not working.

local RunService = game:GetService("RunService")
local character = script.Parent.Parent
local parts = {}
for i, v in pairs(character:GetChildren()) do
	if v:IsA("BasePart") and string.find(v.Name, "Leg") then
		table.insert(parts, v)
	elseif string.find(v.Name, "Arm") then
		table.insert(parts, v)
	end
end

RunService.RenderStepped:Connect(function()
	for i, v in pairs(parts) do
		v.CanCollide = true
	end
end)

To make it so the player can’t get back up, just disable the humanoid states you dont want with Humanoid:SetStateEnabled().

To explain exactly how to do the rest, I would need to understand how your ragdoll system works.

HumanoidStateType

Edit:

Huh, that worked for the system I used in the past. You could try locking the humanoid in a state like Seated, Physics, or Ragdoll. The humanoid shouldn’t make the character do that weird limp standing thing when it’s not applying forces.

I’m already using that, nothing changed.
Ragdoll Script:

local Ragdolls = {}

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

Ragdolls.Stand = function(char, player, humanoid)
	char.Humanoid.BreakJointsOnDeath = true
	char.Humanoid.WalkSpeed = 16
	char.Humanoid.JumpPower = 50 
	for _, v in pairs(char:GetDescendants()) do
		if v.Name == "SAttachment0" then 
			v:Destroy() 
		elseif v.Name == "SAttachment1" then	
			v:Destroy() 
		elseif v.Name == "RagdollWeld" then
			v:Destroy() 
		elseif v:IsA("BallSocketConstraint") then
			v:Destroy() 
		end
	end
	for _, v in pairs(char:GetDescendants()) do
		if v:IsA("Motor6D") then
			v.Enabled = true
		end
	end
	if player ~= nil then
		game.ReplicatedStorage.Events.Extras.RagdollEvent:FireClient(player, "Stand")
	end
end
return Ragdolls
1 Like

@RefusalMan’s script is working properly only after the knockback took place at least a couple of times.

@BendsSpace, I have two scripts that handle the knockback thing. One for the ragdoll, and one for the HumanoidStateType. I don’t like using HumanoidStateType since it sometimes lets the player flop around.

1 Like

I kept trying different things, and I changed the Humanoid state changing system and it works a bit better now. But, how do I keep making sure that they are not ragdolling and standing up?

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