This item is not replicated across Roblox’s server/client boundary.
Players property indicates whether
Characters will respawn automatically. The default value is true.
If this property is disabled (false), players
Characters will not spawn until the
Player/LoadCharacter function is called for each
Player - including when players join the game.
This can be useful in games where players have finite lives, such as competitive games in which players do not respawn until a game round ends.
This example demonstrates one possible usage of the
The example below respawns all players in the game, if dead, once every 10 seconds. This means that players who die 1 second after all players respawn must wait 9 seconds until the script loads all
First, this script removes a player’s character when they die and the
Humanoid/Died function fires. This is done so that the respawn loop that executes every 10 seconds reloads that player when it does not find the player’s character in the Workspace.
To work as expected, this example should be run within a
-- Set CharacterAutoLoads to false game.Players.CharacterAutoLoads = false -- Remove player's character from workspace on death game.Players.PlayerAdded:Connect(function(player) while true do local char = player.CharacterAdded:wait() char.Humanoid.Died:Connect(function() char:Remove() end) end end) -- Respawn all dead players once every 10 seconds while true do local players = game.Players:GetChildren() -- Check if each player is dead by checking if they have no character, if dead load that player's character for i, player in pairs (players) do if (not game.Workspace:FindFirstChild(player.Name)) then player:LoadCharacter() end end -- Wait 10 seconds until next respawn check wait(10) end