Here’s my cursor lock script
void Start()
{
playerScale = transform.localScale;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
And my health/Death script
public void onTakeDamage(int damage)
{
health = health - damage;
healthBar.fillAmount = health / startHealth;
if (health <= 0)
{
Destroy(gameObject);
SceneManager.LoadScene("Game Over", LoadSceneMode.Single);
}
}