I’m having a problem with a ragdoll script where if a player health is 20 or less it floats the player where it suppose too stay on the ground and not float does anyone have any solutions for this? Here the script
1 Like
player.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").BreakJointsOnDeath = false;
char.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if (char.Humanoid.Health <= 20) then
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v:Destroy()
end
end
char.HumanoidRootPart.CanCollide = false
end
end)
end)
end)
1 Like
Not sure why you destroy Motor6D, you can just set Part0 or Part1 to nil, because destroying it won’t able to undo it. If you do that on death, yeah you can.
Here’s how to solve the issue:
1 Like
What can I do where if a player as reached a certain amount of health it’ll get up from the ragdoll
1 Like
You can change Part0 or Part1 back to normal, let’s say you change Part0 from Head to nil, change back to Head. But I noticed that the script run every time humanoid health changes, which isn’t good, you have to find whenever Attachment is there or not, if it’s there, leave it and change Part0 or Part1 of Motor6D to nil.