Ragdoll Solution -- R15/Customizable ragdolls for use with Layered Clothing

It would be better if there was a :UnRagdoll feature with :Ragdoll in the module itself, but there is no problem. I edited the module myself.

3 Likes

Been playing around with this system, and canā€™t seem to find a way to make it where Ragdolls remain in the game even after respawning, instead of being destroyed. Is there a way or already is a way to make it where ragdolls donā€™t delete before a certain period of time?

1 Like

I donā€™t think my ragdoll system will interfere with something like that.

Your player character still goes through with how Roblox handles death regularly. You may have to disable that and create a custom respawn system which bypasses removing the characterā€™s parts.

https://developer.roblox.com/en-us/api-reference/property/Players/CharacterAutoLoads

1 Like

You can actually use this code. It will clone the player character, parent it, and rename it after the PlayerRespawnTime. Determined on the DecayTime, the cloned character will be destroyed.
Just make sure you have a folder called Corpses in the workspace and disable character auto loads otherwise, the code wonā€™t work as expectedā€¦
Anyways, there is a chance that the cloned character could float after respawning likely 0-10% and could be more if the player respawning is not in the perfect timeā€¦

local DebrisService = game:GetService('Debris')
local CorpseDecayTime = 60

local function CloneCorpse(Player: Player)
	local PlayerName = Player.Name
	local Character = Player.Character::Model
	Character.Archivable	= true							-- To be able to Clone the Player's dead character.

	-- This loop is to determine if there is another corpse of the player:
	for _, Corpse in pairs(workspace["Corpses"]:GetChildren()) do
		if Corpse.Name == PlayerName.."'s Corpse" then		-- If there is another corpse of the player:
			Corpse:Destroy()								-- It will be destroyed.
		end
	end
	
	task.wait(Players.RespawnTime)
	Player:LoadCharacter()
	
	local ClonedCorpse	= Character:Clone()					-- Cloned player character.
	local CorpseHumanoid = ClonedCorpse:FindFirstChild('Humanoid')::Humanoid
	
	-- Settings:
	ClonedCorpse.Name	= PlayerName.."'s Corpse"
	ClonedCorpse.Parent	= workspace["Corpses"]				-- The parent of the ClonedCorpse after the player respawns.
	CorpseHumanoid.HealthDisplayType = 
		Enum.HumanoidHealthDisplayType.AlwaysOff
	DebrisService:AddItem(ClonedCorpse, CorpseDecayTime)	-- To remove the Corpse after the specified amount of time.

	-- Temporarily fix for the Player's corpse to prevent it from floating:	
	task.defer(function()
		CorpseHumanoid.Health = 100
		task.wait()
		CorpseHumanoid.Health = 0
	end)
end
2 Likes

Would you be up to share?

(i guess i have to type more, thanks roblox)

1 Like

Is there a way to unragdoll the character after calling ragdollMe?

My use case is a stun system that ragdolls the player. Iā€™ve got the ragdoll to work but I canā€™t figure out a way to unragdoll the player given the current API.

EDIT:
solved my own problem:
replaced motor6d:Destroy() on the last else statement of ragdollMe to include:

(right at the beginning define the old collision group:
local oldColGroup = character.HumanoidRootPart.CollisionGroupId)


if destroy == true then
						motor6d:Destroy()
					elseif destroy == false then
						motor6d.Parent = game:GetService("ServerStorage")
						task.spawn(function()
							if delayTime then
								task.wait(delayTime)
								motor6d.Parent = character.UpperTorso
								motor6d.Parent.CanTouch = true
								humanoid.AutoRotate = true	
								character.HumanoidRootPart.CollisionGroupId = oldColGroup
								character.HumanoidRootPart.CanCollide = true

							else
								task.wait(3)
								motor6d.Parent = character.UpperTorso
								motor6d.Parent.CanTouch = true
								humanoid.AutoRotate = true	
								character.HumanoidRootPart.CollisionGroupId = oldColGroup
								character.HumanoidRootPart.CanCollide = true
							end
						end)
					else
						motor6d:Destroy()
					end

1 Like

This looks like a sturdy module, but do you have any plans to fully modularize it? The reliance on physical value representation (ex: Int/NumberValues, BoolValues, etc.) adds a big extra step when integrating to projects using stuff like Rojo and the numerous scripts (5 in the installation guide) could definitely benefit from consolidation (even into multiple sub-modules, which would increase compatibility across the board, but particularly with single-script architecture games).

1 Like

I donā€™t have much experience with Rojo, so will putting the physical values into a module script that the ragdoll scripts will read be of any use?

Are there any other particular things you think would be helpful if partitioned from the main scripts?

1 Like

is there a way to toggle the ragdoll on live players, if so please share

1 Like

so you made it fully toggable on live players? can you please share this with me via .rblx

1 Like

I wish it had an R6 version lol

1 Like

Would you put this in ServerScriptService, as well as add the folder you mentioned into Workspace?

1 Like

Yes, you have to put this function inside the RookstunPlayerRagdoll server script and you can call it after calling deactivateVelocity function.

1 Like

How does it work when you disable ā€œCharacterAutoLoadsā€? When running the game, it just loads the camera view and nothing else. Kind of stupid when it comes to this type of stuff. lol

edit:
As i do some reading, I see that this is more ideal for round based games that have finite lives? Not something you could do for a TDM type scenario where people are constantly respawning every handful of seonds?

1 Like

Do you have any further plans with this? Itā€™s quite good, and updating it with some of the stuff others have mentioned/input on would be quite awesome! the modular idea is also a really sound idea.

Other wise, great creation! I plan on using it, especially since itā€™s got the layered clothing integration.

1 Like

What are you doing for ā€œdestroyā€ and ā€œdelayTimeā€ variable? I wanted to give your addition a try.

I also put the ā€œoldColGroupā€ right under the ā€œragdollMeā€ function. I imagine thatā€™s where you meant to put it?

1 Like

I forgot to say that earlier, but you will have to load the player character manually on joining while this setting is off.

1 Like

Haha! Makes sense, which is the conclusion I saw when reading up on the method you used.

Do you have an individual script you made to load in players manually, or is there another method to this? Iā€™m eager to get your portion working so I can see it in action. lol

1 Like

Could you pleeeeease make a module script so it easier to ragdoll/unragdoll?

1 Like

I got a message saying collisions were bugged so Iā€™ve made a small change to it. I also included an update to the collision group system changing it to the newer naming system.

1.1.2
  • Updated leftover code, changing CanCollide from false to true upon ragdolling
  • Changed Collision Groups to its newer naming system.

I know I had a discussion regarding modularity before, but I have no clue when I can get to that yet. Thereā€™s a lot of plans on my plate with UGC stuff in the future.

2 Likes