game.Players.CharacterAutoLoads=false game.Players.PlayerAdded:connect(function(J)J.CharacterAdded:connect(function(Y)local U=time()while not Y:FindFirstChild("\072\117\109\097\110\111\105\100")and time()-U<10 do wait(.2)end if time()-U>=10 then print("\084\105\109\101\111\117\116 \101\114\114\111\114")else Y.Humanoid.Died:connect(function()if type(OnDeath_Callback)=="\102\117\110\099\116\105\111\110"then OnDeath_Callback(J)end wait(SpawnDelayTime)J:LoadCharacter(true)end)end end)wait(2)J:LoadCharacter(true)end)
--------------------------------------------------------------------------------------------------------
-- Main code

game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(c)
		local t = time()
		while (not c:FindFirstChild("Humanoid")) and ((time() - t) < 10) do
			wait(0.2)
		end -- Wait until Humanoid is present or amount of time waiting is more than 10 seconds

		if (time() - t) >= 10 then
			print("Timeout error") -- If for some reason the Humanoid isn't found in 10 seconds, break the loop. No need to be stuck in an endless and useless loop.
		else
			c.Humanoid.Died:connect(function()
				if type(OnDeath_Callback) == "function" then
					OnDeath_Callback(p)
				end
				wait(SpawnDelayTime)
				p:LoadCharacter(true)
			end)
		end
	end)
	wait(2)
	p:LoadCharacter(true)
end)
