Problem with respawn

I’ve implemented a manual respawn system in my game, where players respawn at specific times. Initially, this worked as expected. However, I’ve recently encountered an issue where players are respawning twice. Even though the respawn timer is set to infinite, this double respawning is occurring.

Here the script part of the script i use to respawn players:

respawnEvent.OnServerEvent:Connect(function(player)
	local lives = player.lives
	local maxLives = player.maxLives
	if lives.Value <= 0 then
		wait(2)
		player:LoadCharacter()
		maxLives.Value = 10
		lives.Value = maxLives.Value
		player.sp.Value = 0
		player.leaderstats.exp.Value = 0
		player.leaderstats.lvl.Value = 1
		player.leaderstats.money.Value = 100
		player.requiredExp.Value = 100
		player.statsFolder.strength.Value = 0
		player.statsFolder.dexterity.Value = 0
		player.statsFolder.luck.Value = 0
		player.statsFolder.wit.Value = 0
		return
	end
	wait(5)
	player:LoadCharacter()
end)

And respawn time is set to infinite:
image

2 Likes

For a custom respawning system, it’s a better idea to use Players.CharacterAutoLoads instead of RespawnTime. This is probably what’s causing the double respawning.

You’ll also have to implement a custom spawning system too, since once the player joins, his character won’t automatically spawn.

Also, please use task.wait() instead of wait():pray:

2 Likes

Ok yeah, solved the thing, made a small character load script and looks like it works, thx for the help. And yeah, my bad i forgot to put task.wait() :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.