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

Players.CharacterAutoLoads

Players.CharacterAutoLoads

Oct 01 2018, 1:46 AM PST

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() -- load the character for the first time
end)