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

How would I make a script that makes a player respawn every _ seconds?

I'm new at coding, I know very little on how to code but I have been able to create some simple scripts (walkspeed, map changing, instant respawn) so far. However I'm having trouble finding info on how to make a player respawn automatically every _ seconds. I need to do this because in the midst of map changing the player falls into the void and dies. Thanks!

1 comment

0

Alternatively instead of respawning them constantly, you can teleport them to a game lobby or respawn them in one until the new map loads.

3 answers

local player = "mamaluigi1234" -- Change to the name of the player
local seconds = 60 -- Change to how many seconds between respawns

while true do
	wait(seconds)
	if game.Players[player] then
		game.Players[player]:LoadCharacter()
	end
end

1 comment

0

if game.Players[player] would error if the player left the game.

game.Players.PlayerAdded:Connect(function(player)
	while wait(5) do -- changed 5 to whatever time you need
		player:LoadCharacter()
	end
end)

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