i am trying to make a script that makes a player take damage and eventually switch the scene when the enemy gets to close

I don’t have a script because everything I tried failed so do you guys have an answer?

first in need a health script
I used this guy’s video it’s a really great over-all first-person script:

https://www.youtube.com/watchv=HMAs9_2yTuo&list=PLfhbBaEcybmgidDH3RX_qzFM0mIxWJa21&index=10

add a script on enemy with on collision and load scene and a triggered box collider on the enemy

SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);

//or

 SceneManager.LoadScene(“scene name or  number in build index”);

Also must have this in the top where it says using UnityEngine;

using UnityEngine.SceneManagement;