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: