public IEnumerator RespawnPlayerCo() { // Create instance of DeathParticle Instantiate(deathParticle, player.transform.position, player.transform.rotation); // Disable the Player and hide them on death player.enabled = false; player.GetComponent <Renderer>().enabled = false; cameraController.isFollowing = false; gravityStore = player.GetComponent <Rigidbody2D>().gravityScale; player.GetComponent <Rigidbody2D>().gravityScale = 0f; player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; ScoreManager.AddPoints(-deathPointPenalty); // printf to make sure it works Debug.Log("Player Respawn"); // Wait for respawnDelay seconds before continuing yield return(new WaitForSeconds(respawnDelay)); // Move Player to the position of currentCheckpoint player.transform.position = currentCheckpoint.transform.position; player.knockbackCount = 0; // Re-enable Player and make them visible again player.enabled = true; player.GetComponent <Rigidbody2D>().gravityScale = gravityStore; player.GetComponent <Renderer>().enabled = true; healthManager.PlayerFullHealth(); healthManager.isDead = false; cameraController.isFollowing = true; time.ResetTime(); // Create instance of SpawnParticle at currentCheckpoint Instantiate(spawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }