PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

LoadCharacter

Creates a new character for the player, removing the old one. Also clears the player’s Backpack and PlayerGui.

Returns

Return Type Summary

Code Samples


How to Turn of Auto-Loading and Simulate Character Respawn

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

local respawnDelay = 5

game.Players.CharacterAutoLoads = false

game.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()
				wait(respawnDelay)
				player:LoadCharacter()
			end)
		end
	end)
	player:LoadCharacter() -- load the character for the first time
end)