Sorry, I got it working, Rigging error on my part.
Would have been nice to know how to actually implement this without the use of bind keys or tools
ie
--[[
This is a test file to demonstrate how ragdolls work. If you don't use
this file, you need to manually apply the Ragdoll tag to humanoids that
you want to ragdoll
--]]
Is mentioned, but no where does it show you how to actually do this or what you mean by it
By reading through the module you can see that the ragdoll is activated when the humanoid state is set to physics or died (you can add your own states too).
Hey there! I’ve been having a problem with your Ragdoll script! For some reason this bug happens where my R15 Character starts sliding on any part when I jump into it sometimes.
Can you post this as a bug in Engine Bugs? It’s likely the engine isn’t simulating the character correctly. It would also be interesting to see what this looks like from the server’s point of view.
I’ve been having the same issue as @Kabozhi , I was looking through devforum to see if anyone else has been having the same problem and I came across this;
Other than this weird bug, works pretty good.
Hey yeah I’d love to post it in Engine Bugs, but I’m not too informed on the details of why or how its happening, all I know is that its related to this Rag doll Script.
Here’s how it looks from the servers point of view.
This looks like what happens when an R15 character has no HipHeight, or the bottom of its HumanoidRootPart touches the ground.
Seems to be broken for me
ReplicatedStorage.RagdollHandler:20: attempt to index nil with ‘GetChildren’
function setRagdollEnabled(humanoid, isEnabled)
local ragdollConstraints = humanoid.Parent:FindFirstChild("RagdollConstraints")
for _,constraint in pairs(ragdollConstraints:GetChildren()) do -- ERROR HERE
if constraint:IsA("Constraint") then
local rigidJoint = constraint.RigidJoint.Value
local expectedValue = (not isEnabled) and constraint.Attachment1.Parent or nil
if rigidJoint.Part1 ~= expectedValue then
rigidJoint.Part1 = expectedValue
end
end
end
end
The only changes I made were
- Removed the TestScript
- Add the ragdoll using my own character manager.
local function SetupRagdoll(player, character)
player.CharacterAppearanceLoaded:Wait()
wait(0.1)
local Humanoid = character:FindFirstChildOfClass('Humanoid')
buildRagdoll(Humanoid)
end
function CharacterManager.Setup(player)
player:LoadCharacter()
end
function CharacterManager.CharacterAdded(player, character)
SetupRagdoll(player, character)
TagManager(player, character)
character.Humanoid.Died:Connect(function()
for i, v in pairs(Settings.ACTIVE_PLAYERS) do
if v == player then
table.remove(Settings.ACTIVE_PLAYERS, i)
end
end
CharacterManager.Setup(player)
end)
end
-- Get's fired like so
player.CharacterAdded:Connect(function(character)
CharacterManager.CharacterAdded(player, character)
end)
Also getting this error
Which prevents the player from respawning. Note, this error only occurs when being killed via a weapon. For some reason it all stills works for resetting
CharacterAppearanceLoaded
Isn’t very reliable. Can you verify it is firing and that the ragdoll constraints are being created in the explorer?
I mean, that’s what you use in your code tho?
It works for resetting. Only is buggy when being killed using a weapon
I am having issues. I am trying to keep the Ragdoll on death. What I currently do is clone the character a couple seconds after it dies but then the Ragdoll returns to a bricked state where the contraints are “Enabled” but don’t ragdoll.
There’s still countless problems with this
When a player dies, it does the ragdoll, but the dead player can still move around (as like their camera) and they don’t respawn
https://gyazo.com/3b4f63839a36e7b1d20e0322307a2d82
There are a number of underlying issues with humanoids that prevent ragdolls in general from behaving properly. Humanoid state randomly fails to set, resets when network ownership changes, and doesn’t replicate, which can cause the issues you are seeing. You would need to file a bug report for this.
As for not respawning, these ragdolls don’t touch anything in that area. What may be happening is that your game is running slow which both 1) exacerbates the humanoid state issues and 2) causes issues with respawn.
Has anyone figured out a solution to this problem?
Yes! Set ownership of the cloned ragdoll to the server, and re-set the Humanoid state to physics.
@EchoReaper, Hi
I have found an interesting bug and I have decide to ask you for assistance on finding the source after I did some debugging but I couldn’t find what is causing this:
I’m not entirely sure how attachment.Name
could be indexing nil
when it clearly prints LeftLowerArm
Code
local function buildAttachmentMap(character)
local attachmentMap = {}
-- NOTE: GetConnectedParts doesn't work until parts have been parented to Workspace, so
-- we can't use it (unless we want to have that silly restriction for creating ragdolls)
for _,part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
for _,attachment in ipairs(part:GetChildren()) do
if attachment:IsA("Attachment") then
local jointName = attachment.Name:match("^(.+)RigAttachment$")
local joint = jointName and attachment.Parent:FindFirstChild(jointName) or nil
if joint then
print(joint,joint.Part0,attachment.Name)
print("joint,joint.Part0,attachment.Name")
attachmentMap[attachment.Name] = {
Joint = joint,
Attachment0=joint.Part0[attachment.Name];
Attachment1=joint.Part1[attachment.Name];
}
end
end
end
end
end
return attachmentMap
end
I would like to mention that I have never modified your Module, I have read through the source multiple times and have a good idea of what it does and how it works.
I’m more than happy to send you the Repro file privately.
I have the solution for the “Phase through object” bug.
You need to disable/enable the collision on the humanoidRootPart when the ragdoll is active/deactive. It’s set to always disabled when the ragdoll is created, but this is not correct.
function setRagdollEnabled(humanoid, isEnabled)
...
local rootPart = humanoid.Parent:FindFirstChild("HumanoidRootPart")
if rootPart then
rootPart.CanCollide = not isEnabled
end
end
Also it’s possible to simply send a manual event from the client to the server, when the clients humanoid state changes, and apply the state manually to the players humanoid on the server. This fixes the bug in 99.9% of cases.
My code for doing this is not super pretty, but it works well enough.