what I’m trying to do is have the ragdoll function continue to run even when the bleedout function is called. It doesn’t work with or without coroutine. This might seem obvious, but I’m not sure why it won’t work.
no print statement is ran after and the ProximityPrompt is never made.
If it helps this is a module script.
function bleedout(chr, hum)
wait(6)
if hum:GetState() == Enum.HumanoidStateType.Ragdoll then
chr:FindFirstChild("Health").Enabled = false
repeat
if hum:GetState() == Enum.HumanoidStateType.Ragdoll then
wait(3.5)
hum.Health -= 3.5
end
until hum:GetState() ~= Enum.HumanoidStateType.Ragdoll
end
end
function ragdoll_handler.ragdoll(chr, length, revive, death)
local plr = game:GetService("Players"):GetPlayerFromCharacter(chr)
local head = chr:FindFirstChild("Head")
local torso = chr:FindFirstChild("Torso")
local leftarm = chr:FindFirstChild("Left Arm")
local rightarm = chr:FindFirstChild("Right Arm")
local leftleg = chr:FindFirstChild("Left Leg")
local rightleg = chr:FindFirstChild("Right Leg")
local hum = chr:FindFirstChild("Humanoid")
ragdollstate_event:FireClient(plr, hum, "ragdoll", revive)
createattachtments(head, torso, leftarm, rightarm, leftleg, rightleg)
motor6d(torso)
for _, possibletool in pairs(chr:GetChildren()) do
if possibletool:IsA("Tool") then
possibletool.Parent = plr.Backpack
end
end
torso.Parent:FindFirstChild("HumanoidRootPart").CanCollide = false
if revive == true then
if death == true then
coroutine.wrap(bleedout(chr,hum))
print("hello")
end
local revive_prompt = Instance.new("ProximityPrompt", torso)
revive_prompt.Name = "ReviveProximityPrompt"
revive_prompt.RequiresLineOfSight = false
revive_prompt.HoldDuration = 3.55
revive_prompt.MaxActivationDistance = 4.65
revive_prompt.ActionText = "Revive "..plr.DisplayName
revive_prompt.ObjectText = "Current Health "..math.round(hum.Health).."%"
revive_prompt.TriggerEnded:Connect(function()
motor6d(torso)
for _, ragdoll_debris in pairs(chr:GetDescendants()) do
if ragdoll_debris:IsA("BallSocketConstraint") then
ragdoll_debris.Attachtment0:Destroy()
ragdoll_debris.Attachtment1:Destroy()
ragdoll_debris:Destroy()
end
end
end)
end
end