Forcing player to stand upright after getting up from ragdoll

I’m trying to achieve the player standing upright after getting up from ragdoll, because it may glitch out when the player is trying to stand up after recovering from ragdoll. I’ve tried bodygyros, but don’t really know how they work. I have also tried disabling the fallingdown and Ragdoll statetypes to make them get up instantly, but that doesn’t work either… Any way I can achieve this?
Here’s the ragdoll code

function createjoint(parent,jointtype)
	local joint = script.Part[jointtype]:clone()
	joint.Parent = parent
	joint.Name = joint.Parent.Name.."Joint"
	local connector = script.Connector:Clone()
	connector.Parent = joint.Parent.Parent.Torso
	connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
	connector.Attachment1 = joint
	local eh = Instance.new("IntValue")
	eh.Name = "ExtraJoint"
	eh.Parent = joint
	local eh2 = eh:Clone()
	eh2.Parent = connector
end
		local character = char
	
		spawn(function()
		wait()
		plr.Character.Parent = game.Workspace.Players
		for i,v in pairs(script.Torso:GetChildren()) do
			if v.ClassName == "Attachment" then
			v.Parent = character.Torso
			end
		end
			createjoint(character["Right Arm"],"ArmJoint")
			wait()
			createjoint(character["Left Arm"],"ArmJoint")
			wait()
			createjoint(character["Right Leg"],"LegJoint")
			wait()
			createjoint(character["Left Leg"],"LegJoint")
			wait()
		end)
		local hum = char:WaitForChild('Humanoid') 
		local par = hum.Parent


local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint

local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
					

function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
local F = v:Clone()
F:ClearAllChildren()
F.Size = Vector3.new(1,1,.5)
F.Parent = v
F.Transparency = 1
F.Name = "Joint"
F.CanCollide = true
local WELD = Instance.new("Weld",F)
WELD.Part0 = F
WELD.Part1 = v
end	
end
hum.PlatformStand = true
hum.AutoRotate = false
--BIGBOYJOINT.Parent = nil



	for i = 1, #Motors do
	if Motors[i].ClassName == "Motor6D" then
	Motors[i].Parent = nil
	end
	end

end

function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil	
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
hum.AutoRotate = true
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = char.Torso
end
end
end
4 Likes

Make a GUI or download A GuI i hope its work

To provide more context, I tried using a bodygyro but I didn’t know how i’d work with it…

2 Likes

You may use

humanoid.StateChanged:Connect(function(old, new)
    if new == Enum.HumanoidStateType.Ragdoll then
  	    humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
    end
end)
2 Likes

I think I have already disabled it in this script:

game.Players.PlayerAdded:connect(function(player) --Fires when you join the server
	local plr = player
	player.CharacterAdded:connect(function(character) --Makes it so when your character spawns the event fires
		wait(.2)
		local stateType = Enum.HumanoidStateType

		local humanoid = character:WaitForChild("Humanoid")

		humanoid:SetStateEnabled(stateType.FallingDown, false)
		humanoid:SetStateEnabled(stateType.Ragdoll, false)
		
		
		end)
end)
1 Like

Anyone else have any solutions?

Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)

The moment this is called, the player will go from ragdolled mode to standing up.
Hope this your solution.

5 Likes

Still having the issue.
This is the kind of issue I am facing, and moving the camera with shift lock can also bring this flinging result: https://gyazo.com/fdec49cad0f48fd9d3bbd132ac9e6771
Here’s the code that sets the state to standing up, the changestate is in UnRagdoll()

wait(2)
local plr = script.Parent.Parent
local char = plr.Character
local target = workspace.Rigs.warycoolio.HumanoidRootPart
local player = char.HumanoidRootPart
function createjoint(parent,jointtype)
	local joint = script.Part[jointtype]:clone()
	joint.Parent = parent
	joint.Name = joint.Parent.Name.."Joint"
	local connector = script.Connector:Clone()
	connector.Parent = joint.Parent.Parent.Torso
	connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
	connector.Attachment1 = joint
	local eh = Instance.new("IntValue")
	eh.Name = "ExtraJoint"
	eh.Parent = joint
	local eh2 = eh:Clone()
	eh2.Parent = connector
end
		local character = char
	
		spawn(function()
		wait()
		plr.Character.Parent = game.Workspace.Players
		for i,v in pairs(script.Torso:GetChildren()) do
			if v.ClassName == "Attachment" then
			v.Parent = character.Torso
			end
		end
			createjoint(character["Right Arm"],"ArmJoint")
			wait()
			createjoint(character["Left Arm"],"ArmJoint")
			wait()
			createjoint(character["Right Leg"],"LegJoint")
			wait()
			createjoint(character["Left Leg"],"LegJoint")
			wait()
		end)
		local hum = char:WaitForChild('Humanoid') 
		local par = hum.Parent


local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint

local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
					

function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
local F = v:Clone()
F:ClearAllChildren()
F.Size = Vector3.new(1,1,.5)
F.Parent = v
F.Transparency = 1
F.Name = "Joint"
F.CanCollide = true
local WELD = Instance.new("Weld",F)
WELD.Part0 = F
WELD.Part1 = v
end	
end
hum.PlatformStand = true
	hum.AutoRotate = false

--BIGBOYJOINT.Parent = nil



	for i = 1, #Motors do
	if Motors[i].ClassName == "Motor6D" then
	Motors[i].Parent = nil
	end
	end

end

function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil	
for i,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
	hum.AutoRotate = true
	hum:ChangeState(Enum.HumanoidStateType.GettingUp)
for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
Motors[i].Parent = char.Torso
end
end
end

local EFFECTS = char:WaitForChild("StatusEffects")
EFFECTS.ChildAdded:Connect(function(CHILD)
	if CHILD.Name == "Effects" then
		local EFFECTS = char:WaitForChild("StatusEffects")
	end
	 if CHILD.Name == "Ragdoll" then
	 hum:UnequipTools()
	 Ragdoll()
	 end
	end)
	 EFFECTS.ChildRemoved:Connect(function(CHILD)
	 if CHILD.Name == "Ragdoll" then
	 if EFFECTS:FindFirstChild("Ragdoll") == nil then
	 UnRagdoll()
	 end
	 end	
	end)
	
	plr.Character.ChildAdded:connect(function(child)
		if char.StatusEffects:FindFirstChild("Ragdoll") and child.ClassName == "Tool" then
			hum:UnequipTools()
		end
	end)

Instead of re-parenting the motors, just try disabling them.

1 Like

The same issue is still happening.

Notice how the arms and legs go inside the baseplate.

That could be causing the problem.

As a side note, the code here is just plain awful alone. It’s a bit difficult to read with the weird variable names and inconsistent formatting.

1 Like

To fix this, would I disable collisions on the legs and arms? I don’t know how to make it fix the arms and legs up. Also for the code part, I will be renaming some of the variables and make it more understandable shortly.

Try that, it could work. They shouldn’t be colliding anyways.

https://gyazo.com/bc035aa794374a9cee010aa619858bfa
Disabling collisions hands me this result.

When the ragdoll enables, create collision boxes and filters.

1 Like

How would I go about doing this? I fixed the arms flailing around by keeping the joints cancollide on, but it still brings me the getting up issue. Here’s the code.


wait(2)
local plr = script.Parent.Parent
local char = plr.Character
local target = workspace.Rigs.warycoolio.HumanoidRootPart
local player = char.HumanoidRootPart
function createjoint(parent,jointtype)
	local joint = script.Part[jointtype]:clone()
	joint.Parent = parent
	joint.Name = joint.Parent.Name.."Joint"
	local connector = script.Connector:Clone()
	connector.Parent = joint.Parent.Parent.Torso
	connector.Attachment0 = joint.Parent.Parent.Torso:FindFirstChild(joint.Name)
	connector.Attachment1 = joint
	local ExtraJoint = Instance.new("IntValue")
	ExtraJoint.Name = "ExtraJoint"
	ExtraJoint.Parent = joint
	local ExtraJointClone = ExtraJoint:Clone()
	ExtraJointClone.Parent = connector
end
		local character = char
	
		spawn(function()
		wait()
		plr.Character.Parent = game.Workspace.Players
		for i,v in pairs(script.Torso:GetChildren()) do
			if v.ClassName == "Attachment" then
			v.Parent = character.Torso
			end
		end
			createjoint(character["Right Arm"],"ArmJoint")
			wait()
			createjoint(character["Left Arm"],"ArmJoint")
			wait()
			createjoint(character["Right Leg"],"LegJoint")
			wait()
			createjoint(character["Left Leg"],"LegJoint")
			wait()
		end)
		local hum = char:WaitForChild('Humanoid') 
		local par = hum.Parent


local Motors = {char.Torso:FindFirstChild("Left Hip"),char.Torso:FindFirstChild("Left Shoulder"),char.Torso:FindFirstChild("Right Hip"),char.Torso:FindFirstChild("Right Shoulder")}
local BIGBOYJOINT = char.HumanoidRootPart.RootJoint

local VALUEe = Instance.new("BoolValue")
VALUEe.Name = "Stun"
					

function Ragdoll()
char.HumanoidRootPart.Anchored = false
VALUEe.Parent = char.StatusEffects
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
			local partclone = v:Clone()
			v.CanCollide = false
			partclone:ClearAllChildren()
			partclone.Size = Vector3.new(1,1,.5)
			partclone.Parent = v
			partclone.Transparency = 1
			partclone.Name = "Joint"
			partclone.CanCollide = true
			local WELD = Instance.new("Weld",partclone)
			WELD.Part0 = partclone
WELD.Part1 = v
end	
end
hum.PlatformStand = true
	hum.AutoRotate = false

--BIGBOYJOINT.Parent = nil



	for i = 1, #Motors do
		if Motors[i].ClassName == "Motor6D" then
			Motors[i].Enabled = false
	--Motors[i].Parent = nil
	end
	end

end

function UnRagdoll()
char.HumanoidRootPart.CFrame = char.Torso.CFrame
BIGBOYJOINT.Parent = char.HumanoidRootPart
VALUEe.Parent = nil	
for i,v in pairs(char:GetDescendants()) do
		if v:IsA("BasePart")  then
			v.CanCollide = true
if v.Name == "Joint" then
v:Destroy()
end
end
end
hum.PlatformStand = false
	hum.AutoRotate = true
	hum:ChangeState(Enum.HumanoidStateType.GettingUp)

for i = 1, #Motors do
if Motors[i].ClassName == "Motor6D" then
			--Motors[i].Parent = char.Torso
			Motors[i].Enabled = true
end
end
end

1 Like

Can someone help me find a solution to this? This is a huge issue i’ve been dealing with and I’m trying to fix this for the past night now.

1 Like

Maybe using GettingUp state?

humanoid.StateChanged:Connect(function(old, new)
    if new == Enum.HumanoidStateType.Ragdoll then
        humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
    end
end)

Edit: Silly me! I didn’t see that.

1 Like

In the UnRagdoll() function, I set the humanoid state to gettingup

1 Like

Would I have to use a bodygyro to set the player’s orientation to standing upright.?

1 Like