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.
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?
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
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
Would you be up to share?
(i guess i have to type more, thanks roblox)
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
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).
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?
is there a way to toggle the ragdoll on live players, if so please share
so you made it fully toggable on live players? can you please share this with me via .rblx
I wish it had an R6 version lol
Would you put this in ServerScriptService, as well as add the folder you mentioned into Workspace?
Yes, you have to put this function inside the RookstunPlayerRagdoll
server script and you can call it after calling deactivateVelocity
function.
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?
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.
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?
I forgot to say that earlier, but you will have to load the player character manually on joining while this setting is off.
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
Could you pleeeeease make a module script so it easier to ragdoll/unragdoll?
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.