Character not respawning after death

Character doesn’t respawn after death. It even starts regenerating health afterwards. Sometimes it does respawn. Usually it doesn’t though.

(EDIT: I think its the ragdoll script because when I disable it it stops happening. Idk what my ragdoll script is doing thats bad.)

Here is a video:

Here is some code I think could be an issue:

ServerScript Snippet #1

humanoid.Died:Connect(function()
			player.hiddenStats.Regen.Value=0
			if not died then
				died = true
				local killer = humanoid:GetAttribute("Killer")
				if killer then
					local killerPlayer = game.Players:FindFirstChild(killer)
					killerPlayer.hiddenStats.Regen.Value+=1
					Events.KOd:FireClient(killerPlayer, player.Name, 25)
					killerPlayer.leaderstats.KOs.Value+=1
					killerPlayer.hiddenStats.Cash.Value+=25
					humanoid:SetAttribute("Killer", nil)
				end
			end
		end)

ServerScript Snippet #2 (Ragdoll)

local debris = game:GetService("Debris")

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").BreakJointsOnDeath = false
	end)
end)

game:GetService("ReplicatedStorage").Events.Ragdoll.OnServerEvent:Connect(function(player)
	local character = player.Character
	local humanoid = character:WaitForChild("Humanoid")
	local root = character:WaitForChild("HumanoidRootPart")

	if humanoid and root then
		humanoid.Health = 0
		humanoid:ChangeState(Enum.HumanoidStateType.Physics)
		humanoid.PlatformStand = true

		local force = Instance.new("BodyVelocity")
		force.MaxForce = Vector3.new(1,0,1) * 10000
		force.Velocity = root.CFrame.LookVector * -50
		force.Parent = root

		for i, v in pairs(character:GetDescendants()) do
			if v:IsA("Motor6D") then
				local at0 = Instance.new("Attachment", v.Part0)
				local at1 = Instance.new("Attachment", v.Part1)
				at0.CFrame = v.C0
				at1.CFrame = v.C1

				local con = Instance.new("RopeConstraint", v.Part0)
				con.Name=v.Name
				con.Length = 0.1
				con.Attachment0 = at0
				con.Attachment1 = at1

				v:Destroy()
			end
		end

		debris:AddItem(force, 0.1)
	end
end)

Any help is appreciated. Thanks.

2 Likes

image

hey umm. your health isnt 0.

here’s what you should try:
Create an empty value in StarterCharacterScripts named “Health”

Still doesn’t work.

Have you checked the Players service?
image

1 Like

Maybe it could be this line in the ragdoll script:

humanoid:ChangeState(Enum.HumanoidStateType.Physics)

It might be skipping the Dead state type and going directly to Physics or something like that. Try commenting it out or waiting right before you set it.

Edit: You could also implement custom respawn logic…

Changed it to this and it still happens…

humanoid:ChangeState(Enum.HumanoidStateType.Dead)
task.wait(0.5)
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
humanoid.PlatformStand = true
1 Like

Sorta fixed this by cloning the character and ragdolling the clone instead.

1 Like

Possible Solution 1
Kill the player, then after a few seconds force respawn the player with LoadCharacter.

Possible Solution 2
Set the state to fallingdown and then disable the gettingup state
(Might be a problem with the physics or platformstand state)

1 Like