You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? When you die with a tool (guns, melee), you actually don’t die and you ragdoll with your body parts being all cancollide on so the characters parts doesn’t go underneath the floor.
What is the issue? I cannot figure how to do so, now the reason why I want cancollide on when you die, is cause when resetting in roblox, it automatically sets them cancollide. Which is perfect for my issue.
What solutions have you tried so far? Tried looking over devforum posts and youtube, didn’t find much help just regular ragdolls with the same ragdoll.
I made it so when you are below 10 health and was shot you get your motor6d’s automatically removed, that’s how the ragdoll functions itself. I couldn’t find a way to just disable death and let him stay like that.
let’s take da hood for an example, or many other games like the streets. when you get killed you ragdoll down the ground and stay there until you are rescued, or self-healed.
Try using fake health instead. When it falls below 0, put the player into a ragdoll state where they’ll be stuck like that.
You’d just need to refactor code to modify the user’s fake health instead of their humanoid health. As soon as the humanoid enters the dead state you cannot restore it back to any other state, and the character will respawn automatically.
Use either an attribute on the character or a NumberValue to store fake health. This makes it so once it reaches 0 the character doesn’t die automatically (how humanoids naturally function)
Better outline:
local function doDamage(damageAmount)
char.Health.Value -= damageAmount
if char.Health.Value <= 0 then
--//Put character into a ragdoll state at this point
end
end
Sure, no problem!. This is what I mean by body parts being
and
, now you might be confused on how I got it to be cancollide on. Well actually it was automatically turned on by roblox when you reset, I want it to function like that when I ragdoll. I’ve tried to use a loop to set the bodyparts cancollide on but no luck.
I just tested this out myself. Setting the humanoid state to Physics allows you to do this.
--//client code
char.Health:GetPropertyChangedSignal("Health"):Connect(function()
if char.Health.Value <= 0 then
char.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
end
end)
What I do is a hacky solution but I just add clone the bodyparts in the character, break their joints via part:BreakJoints() put them in workspace and weld them via WeldConstraint to the said bodypart.
You can do this with a for loop, if you need an example ask me.
-- whatever ragdoll funny stuff goes on here lol.
for _, v in ipairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
local p = v:Clone()
p.Anchored = false
p.CanCollide = true
p.CFrame = v.CFrame
local w = Instance.new("WeldConstraint")
w.Part0 = v
w.Part1 = p
w.Parent = p
end
end
If you destroy the Neck weld (Motor6D) then the player will die. If you don’t delete the Neck and use @C_Sharper’s suggestion about ‘false’ health that might be the easiest way of not dying.
I’ve heard others say they use BallSocketConstraints for ragdoll purposes, with limits for the amount they can rotate & limits on the angles as well, and make them CanCollide true, but also use CollisionGroups so the body, arms and legs don’t collide with each other at each joint.