I’m new at this platform and I’m looking up for some methods to “improve” my script. I’d like to know how could I modify my currently script and make it that a ragdoll activates on: DEATH or Character with less than 35 health. I’m also looking for a method that makes the ragdoll “deactivates” when the player has gotten more than 35 health.
The code I’m currently using… only works for when a player dies.
pcall(function()
local humanoid = script.Parent.Humanoid
humanoid.BreakJointsOnDeath = false
humanoid.Died:Connect(function()
for index,joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint:Destroy()
end
end
end)
end)
If you have any clue about how do I modify the script into what I am looking for, it would be great.
In my opinion you should do the same whenever you want the character to ragdoll and what you need to add if you want for a player to ragdoll on low health just simply do this:
humanoid.HealthChanged:Connect(function()
local health = humanoid.Health
local RagdollHealth = 35
if health < RagdollHealth then
-- ragdoll stuff here
elseif health > RagdollHealth then
-- unragdoll stuff here
end
end)
and if you want for the character to unragdoll just simply enable every motor6d in the player’s torso.
Ok using PlatformStand it works but, there is an issue.
When the player dies he fully gets ragdolled, just like this photo.
But when the player achieves the RagdollHealth, he simply ragdolls but it looks like this
Plus, he doesn’t unragdolls
I’ve made the changes into the script and it finished like this:
pcall(function()
local humanoid = script.Parent.Humanoid
local Torso = script.Parent.Torso
humanoid.BreakJointsOnDeath = false
humanoid.HealthChanged:Connect(function()
local health = humanoid.Health
local RagdollHealth = 35
if health < RagdollHealth then
humanoid.PlatformStand = true
for index,joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint:Destroy()
end
end
elseif health > RagdollHealth then
humanoid.PlatformStand = false
for index,joint in pairs(Torso:GetDescendants()) do
if joint:IsA("Motor6D") then
joint.Enabled = true
end
end
end
humanoid.Died:Connect(function()
humanoid.Jump = true
for index,joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint:Destroy()
end
end
end)
end)
end)
iirc you have to use a localscript to change the HumanoidState and use Humanoid:ChangeState(), and then destroy the joints and replace it with new joints
I can’t destroy all of the Attachments and Motor6Ds, that would break my whole character. And your suggestion didn’t work as well, it just broke even more the character.
I can move around but my character would still be on the floor.
Yup, the ragdoll is for a related rake game of mine.
And, I’m not sure how would I use Collider Parts to make an ragdoll, I’m totally new at making ragdolls, and as I said, I’ve searched through this platform trying to make a successfully ragdoll.
whenever a player ragdolls the joints in the torso are disabled
and the collider parts’s cancollide setting is set to true so the collider part would stop the joints like falling off the map
use attachments and ballsockets and colliderparts i dont know if the rake classic edition uses more than those because i have never exploited or any stuff related with exploits.
you could try searching for good ragdoll system in the toolbox if you just cannot make one i highly recommend you if you use a free model ragdoll system first of all check if there is any viruses.
I forgot to tell you, but my second way to make a ragdoll, it was getting one ragdoll system from TOOLBOX and “rescript” it, yk? Turns out it didn’t work and the system is all messed up. But i’ll try your method, thanks.