If the player kills the NPC, it crashes

Doing what chrudimer said made it really easy to get PlayerController. Thank you so much. I solved it thanks to you!
And thank you so much for telling me the problem with my code. It was an honor to learn!