Character does not respawn after a period of time?!

Im trying to make a zombie game. Therefore I basically just have a model of a zombie which is the same of a character just with some parts. When I set the player’s character to the zombie everything is fine.

When I “Zombify” the player and reset instantly the character respawns. However, if I wait a period of time like 10 seconds and then reset, the character does not respawn. And CharacterAutoLoads is indeed enabled.

Here is the zombify script;

local ZombieModel = Zombies.Normal:Clone()
ZombieModel.Parent = workspace
ZombieModel:MoveTo(player.Character.Torso.Position)
ZombieModel.Name = player.Name
player.Character = ZombieModel

And yes I did google it, asked my friends, browsed through the forum and nothing.
Much help appreciated :slight_smile:

2 Likes

Does the character actually die and not respawn?
Or is it literally not allowing you to reset?

No, it is like I reset and the player dies and the limbs fall apart etc. However it’s really weird like if i reset seconds after i get “Zombified” i respawn, however if I respawn 20 seconds or so I don’t?

Since you are directly inserting a custom character and thus overwriting the player’s original character, you should call player:LoadCharacter() in case the new humanoid dies.

A simple script inside your zombie model could look like this:


Humanoid.Died:connect(function()

if game.Players:GetPlayerFromCharacter(script.Parent) ~= nil then

local player = game.Players:GetPlayerFromCharacter(script.Parent)

wait(5)

player:LoadCharacter()

end

end)
1 Like

I have a feeling like this is server-side latency on your behalf. There’s clearly no issue with the script (overwriting the Character should not trigger the respawn delay) and the RespawnDelay property is still locked to 5 iirc. Are you perhaps experiencing any other time discrepancies with your code?

I will try this right now, thank you.

No, because as said it respawns if it is like seconds after I get Zombified.

Also another weird thing, when I reset quickly after I get zombified I respawn instantly? Which is quite weird because I never changed the respawn time?

Anyways it did solve the problem I do respawn now but I just gotta figure out what is going on and why I respawn in different times. Thank you :slight_smile: