I have tried making a custom teleport system, but this isn't working and I can't figure out why.

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

Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		
		local Spawn = {player.Backpack.SpawnLocation.Value}
		local spawnLocation = game.Workspace:FindFirstChild(Spawn[1])	
		print(spawnLocation.Name)
		print(spawnLocation.ClassName)
		
		local humanoid = character:findFirstChild("Humanoid")
		if humanoid then
			humanoid.Died:connect(function()
				wait(0.5)
				player:LoadCharacter()
				wait(5)
				print("About To Teleport")
				character.HumanoidRootPart.CFrame = (spawnLocation.CFrame)
				wait(0.2)
				print("Did it work?")
				
			end)
		end
	end)
	player:LoadCharacter()
end)