Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you change the respawn time?

I want to be able to change the respawn time, but I have no idea where the value for it is or where it is used.

10 comments

4

you can load the character manually after a died event :p

2

use :LoadCharacter() to load the character

3

To expand, check for :Died, then :LoadCharacter

0

Proud of the fact that no one answered this formally just for points. OP, include code next time for a working concept.

2

Here comes yHastee to ruin it for everyone.

0

I thought well, I will not answer someone who asked for scripts. answer deleted

0

"answer deleted"... so you did start typing it up?

0

yes. but he did not see it by the way.

0

sneak 100

2 answers

✓ Accepted answer

By default, the character will automatically respawn 3 seconds after death. Disable CharacterAutoLoads so that the player does not spawn or respawn automatically.

When a player joins, their character needs to be added manually using Player:LoadCharacter(). Then, every time the character dies, it needs to be respawned again manually, after the desired delay.

local respawnDelay = 3
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			wait(respawnDelay)
			if player.Parent then
				player:LoadCharacter()
			end
		end)
	end)
	player:LoadCharacter()
end)

In order to change the respawn of a player in your game, first you need to disable automatic respawning which will be done for you in the script I will give to you. In order to turn auto-respawning off you need to change CharacterAutoLoads to false. Next you need to make it so each player gets the same respawn time upon joinning your game by using the PlayerAdded event.

local time = 5 
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(player)
	game.Players.CharacterAutoLoads = true
	repeat wait() until player.Character
	game.Players.CharacterAutoLoads = false
	player.Character.Humanoid.Died:Connect(function()
		wait(time)
		player:LoadCharacter()
	end)
end)

1 comment

0

Sorry, for the nooby answer, but it still should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.