void OnTriggerEnter(Collider collider) { if (collider.tag == "Player") { lastPlayer = collider.transform.GetComponent<PlayerClass>(); if (lastPlayer != null) { lastPlayer.saveCheckpoint(pos); } } }