CharacterAutoLoads

From Legacy Roblox Wiki
Revision as of 21:36, 10 April 2012 by >Anaminus (Created page with "<onlyinclude>{{Property |name = CharacterAutoLoads |type = {{type|bool}} |description=Indicates whether Characters will respawn automatically. |object=Players }}</onlyincl...")
Jump to navigationJump to search
CharacterAutoLoads
Type bool
Description Indicates whether Characters will respawn automatically.
Member of Players


Remarks

If this is set to true, Players will get a character automatically when they join the game, as well as when they die. There is a 5 second delay between death and respawning.

If set to false, Characters wont load automatically, allowing you to respawn manually using LoadCharacter.

Example

This script turns off auto-loading and simulates character respawning.

local respawnTime = 5

local Players = Game:GetService("Players") Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) -- find the humanoid, and detect when it dies local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.Died:connect(function() delay, then respawn the character wait(respawnTime) Player:LoadCharacter() end) end end)

Player:LoadCharacter(true) -- load the character for the first time end)