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

How to change the time the playes respawn?

Hello I have been having a hard time trying to script my players to have to wait longer to respawn.

1 comment

3

Have your script disable CharacterAutoLoads, then use the :LoadCharacter() method to spawn the player.

1 answer

✓ Accepted answer

So here is a basic answer for you:


local RespawnTime = 5; -- in seconds

game.Players.CharacterAutoLoads = false -- makes it so the character wont load till called using :LoadCharacter() event

local function PlayerAdded(Player)

	Player.CharacterAdded:Connect(function(Character) -- CharacterAdded event

		local Humanoid = Character:WaitForChild("Humanoid") -- Wanna wait for the humanoid so we don't get errors!

		Humanoid.Died:Connect(function() -- activates when the character dies x.x
			
			wait(RespawnTime) -- respawn timer!!!

			Player:LoadCharacter() -- after the timer, Load the character!

		end

	end)
	
	print(Player.Name, "has loaded")	

end

game.Players.PlayerAdded:Connect(PlayerAdded) -- Connect PlayerAdded function


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