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

How to change someone's respawn-time locally?

Hello!

I'm trying to make mechanics from popular obbies/difficulty charts on Roblox. There is one specific one where you could change your respawn-time in a settings menu. I know you can change it within Players.RespawnTime, but that makes everyone have the same. You also can't change it locally, so I don't know how I would do this. Any help would be appreciated and I hope this doesn't count as a request. I'm just want to know if there is a easy way of doing this.

2 answers

You can toggle off Players.CharacterAutoLoads by setting it to false at the top of a server script.

From there, you can manually respawn players by waiting for your specified amount of time, and then using Player:LoadCharacter()

For example,

local Players = game.Players
Players.CharacterAutoLoads = false

local respawnTime = 2 -- placeholder

Players.PlayerAdded:Connect(function(playerWhoJoined)
	playerWhoJoined.CharacterAdded:Connect(function(addedCharacter)
		local Humanoid = addedCharacter:FindFirstChildOfClass("Humanoid")
		Humanoid.Died:Connect(function()
			wait(respawnTime)
			playerWhoJoined:LoadCharacter()
		end)
	end)
end)

I don't think you can change it locally, but you can add a script in ServerScriptService and write this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")

		humanoid.Died:Connect(function()
			wait(3) -- time to respawn player
			plr:LoadCharacter()
		end)
	end)
end)

You can set this up for a certain player, like this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")

		humanoid.Died:Connect(function()
			if plr.Name == "NameHere" then
				wait(3) -- time to respawn player
				plr:LoadCharacter()
			end
		end)
	end)
end)

Tell me if you need anything else.

I also made a model just for this case: https://web.roblox.com/library/5572047781/RespawnTimeEditGUI

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