Getting up my from my ragdoll

My ragdoll system doesn’t actually use platformstand, instead it manipulates the ragdoll state and the getup state meaning the player won’t getup then activate the getup state once unragdolled. However, it seems that the player is still in platformstand even after getting up via the bodygyro.

5 Likes

When I print platformStand it prints false the second I press G wich unragdolls me and that prints before and after the code above

1 Like

Wait so how do you use the Ragdoll state to ragdoll? without platformstand on my player is above the world with it’s legs in the air? Not sure how the ragdoll state works sorry.

The wiki is bad at explaining states.

1 Like

The ragdoll state is where the player has no control over their physics so therefore they cannot stand upright. You use ChangeState() to set it to ragdoll, and use SetStateEnabled() to disable the getup state. And basically do the opposite if you want to unragdoll.

2 Likes

Alright thanks let me try that really quick and see how it works out

I re-wrote the whole script in the style you said but the character can still jump and is standing up

Heres the module where I activate the states and such based on what I send to the module

function Status.Ragdoll(Character, ShouldRagdoll, Time)
	if ShouldRagdoll then
		Character:SetAttribute("Stunned", true)
		Character:SetAttribute("Ragdolled", true)
		
		Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
		Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
		Character.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
		
		if type(Time) ~= "number" then return end
		
		coroutine.wrap(function()
			wait(Time)

			Character:SetAttribute("Stunned", false)
			Character:SetAttribute("Ragdolled", false)
			
			Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
			Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		end)()
	elseif not ShouldRagdoll then
		Character:SetAttribute("Stunned", false)
		Character:SetAttribute("Ragdolled", false)
		
		Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
		Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end

--heres the ragdoll script when the stateenabled ragdoll is enabled, I added notes to make it more clear


		--Ragdolled or GettingUp
		local function Ragdoll (State, Enabled)
			if State.Name == "Ragdoll" and not Character:GetAttribute("Dead") and not Character:GetAttribute("BeingCarried") and not Character:GetAttribute("BeingExecuted") then
				--Getting Up
				if not Enabled then
					Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)

					local YOrientation = HumanoidRootPart.Orientation.Y

					local BodyGyro = Library.Functions.BodyGyro(HumanoidRootPart, CFrame.Angles(0, math.rad(YOrientation), 0), 10000, 500)
					BodyGyro.Name = "BodyOrientation"
					Debris:AddItem(BodyGyro, .25)

					--local BodyPosition = Library.Functions.BodyPosition(HumanoidRootPart, HumanoidRootPart.Position)
					--Debris:AddItem(BodyPosition, .25
				end
				
				--Fake Limbs CanCollide with the world / Enabling - Disabling Motors
				for _,v in pairs(Character:GetDescendants()) do
					for _,v in pairs(CollisionGroup[Character]) do
						v.CanCollide = Enabled
					end

					if v:IsA("Motor6D") and v.Name ~= "RootJoint" and not CollectionService:HasTag(v.Parent, "Accessories") and not CollectionService:HasTag(v.Parent.Parent, "Accessories") then
						v.Enabled = not Enabled
					end
				end
				
			end
		end
		--Activates the ragdoll function when the StateEnabled Ragdoll or GettingUp changes
		Humanoid.StateEnabledChanged:Connect(Ragdoll)
1 Like

Heres a gif of this aswell, https://gyazo.com/77689d830373c09d7258627ed59bdd5d

I wish this was easier or I had a better answer kinda sucks not knowing on something like this, :frowning:

Tried a quick thing where I set the states on the client and it kinda worked but I got back up for some reason gonna try a client sided version of this ragdoll thing

1 Like

I’m assuming this was set on the server correct?

1 Like

The issue actually is now that I fixed the fling I think? The ragdoll state after being set doesn’t set back did I do something wrong here?

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = game:GetService("Players").LocalPlayer

ReplicatedStorage.Remotes.Ragdoll.OnClientEvent:Connect(function(Ragdolled)
	if Ragdolled then
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
		Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
	elseif not Ragdolled then
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
		Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end)
1 Like

Honestly I don’t even see the point using bodygyro in my combat system it uses CFrame to set the player CFrame. It also works with NPC’s. Fighting - Roblox(Link to the game) There are probably a lot more humanoid states that mess around and prevent the player physics.

1 Like

Can you tell me the alternative you use to it? I apreciate the help btw.

1 Like

The alternative to what? I can give you an uncopylocked version of the game. Though the code isn’t necessarily nice to read.

2 Likes

Fixed that thing

Just played your game, yeah the thing is when I unragdoll I want to get up facing the way I already was and not cframe instantly I want to kind of rotate up from the ground,
Maybe a animation?

1 Like

It is probably best to use an animation for that. Using bodygyro just doesn’t seem practical.

1 Like

Scratch that I think we did it boss, https://gyazo.com/e9e2243390e984b2460487d6cde112db

I really appreciate the help this is what I was looking for and took days figuring out and your the only person that actually knew how to do it, I didn’t realize that you needed to use states to achieve what I was doing since I wasn’t familiar with those states and figured since roblox states are wonky like landed etc doesn’t always work I would do a custom way tysm!

1 Like

How did you do it I’ve read through the whole conversation and I ain’t understand a thing

1 Like

What did you do to fix it, I’m having the same issue where I’m ragdoll but still standing up!

nvm I fixed it, I just had to do some client/server stuff!