Hey i wanna achieve a dahood ish ragdoll when death and have to wait until health is 50 but the problem is that i could almost do it by changing the character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
and it worked but the problem was that i the health wouldn’t regrenerate. I tried to fix that with a while health < 50 do… But that didn’t work since the humanoids propities couldn’t be changed or atleast the health couldn’t. this is the scripts i use:
SERVER SIDED
local Char = Player.Character
for i, v in pairs(Char:GetDescendants()) do
if v.Name == "BallSocketConstraint" then
v:Destroy()
elseif v.Name == "Attachment1" then
v:Destroy()
elseif v.Name == "Attachment" then
v:Destroy()
end
end
end)
script.Parent.StartRagdoll.OnServerEvent:Connect(function(Player)
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
hum.BreakJointsOnDeath = false
local joints = char:GetDescendants()
for _,joint in pairs(joints) do
if joint:isA("Motor6D") then
local socket = Instance.new("BallSocketConstraint", joint.Parent)
local a0 = Instance.new("Attachment")
local a1 = Instance.new("Attachment")
socket.Attachment0 = a0
socket.Attachment1 = a1
a0.Parent = joint.Part0
a1.Parent = joint.Part1
a0.CFrame = joint.C0
a1.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint:Destroy()
end
end
end)
Client sided:
local Player = game.Players:GetPlayerFromCharacter(character)
local hum = character:WaitForChild("Humanoid")
character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
hum.HealthChanged:Connect(function(health)
if health <= 0 then
script.Parent.StartRagdoll:FireServer()
end
end)