Character not respawning

I’ve got a simple code that kills a player:


image
but when it runs, the player dies, but it’s state doesn’t change to dead, starts healing and stays there forever dead even with
image

Now what do i do, if i do player:loadchar() it loads, but sometimes short after the player loads again (probably when the code above works)

2 Likes

When i run the code twice it works btw (but doesn’t solve my problem)

I have noticed that most ragdoll scripts mess with the respawning of characters. Is there any ragdolling involved in your game? Also, this might be a stupid question, but is this a server-script and not a localscript?

1 Like

I’ve encountered this problem before. It is likely related to the way you are damaging the player. With that being said, if you are damaging the player on a server script, why use the dead state? Roblox has built in functions with humanoid.Died and char added that are designed to work. If none of this helps, submit a bug report detailing the issue including that your script is server and not local.

1 Like

Ofc it’s server sided, the dead state is there just for making sure the character knows it’s dead, even tho after setting it to dead it still says that it’s running or jumping for some reason

1 Like

Definitely submit a bug report

Whole humanoid is held by legacy code, which is really buggy and prone to break. And as far as I know, roblox will not fix it as they are moving the character system to a brand new one made from scratch. What I personally suggest you do is not touch the states at all, as they are really buggy. Let the humanoid set it’s state by itself by setting Health to 0.

If i delete the state line, nothing changes anyway

yeah humanoids are funny, i usually just write my own logic for detecting when a humanoid dies

Humanoid.HealthChanged:Connect(function(newHealth)
if newHealth > 0 then return; end
-- humanoid is dead from here, handle respawn/do death logic
end)

there are a LOT of unreliable humanoid-related events/behaviors

Just set the health to 0 if you want to have it insta-kill

I hope roblox makes a new character system instead of those random sound service reworks and avatar shop services

It’s the same issue, the character doesn’t destroy and player watches itself forever lying on ground

Double check that the Script’s RunContext is set to Server

They already did:

It’s just that they don’t want to override original character system because of the compatibility issues. They did provide a script that converts humanoid physics to a new system so you might use it to fix states and generally have better controls over humanoid movement

EDIT: Technically, it’s not a new character system. What it does is disable replication, states and physics. It does not have a new health system or player modules.